File header
file_header
AstFileHeaderTool — extract the first lines of source files.
Returns the import block, __all__ and TYPE_CHECKING context of one or
more files without a full read — the tool form of the legacy ast:file-header
hook. Registered as ast_file_header via axm.tools entry point.
AstFileHeaderTool
Bases: AXMTool
Extract the first max_lines lines of one or more source files.
Registered as ast_file_header via axm.tools entry point.
Source code in packages/axm-ast/src/axm_ast/tools/file_header.py
name
property
Tool name used for MCP registration.
execute(*, files, path='.', max_lines=_DEFAULT_MAX_LINES, **kwargs)
Extract the header of each file in files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files
|
list[str]
|
File paths relative to path (required). |
required |
path
|
str
|
Project root directory (default |
'.'
|
max_lines
|
int
|
Number of leading lines to keep per file (default 30). |
_DEFAULT_MAX_LINES
|
Returns:
| Type | Description |
|---|---|
ToolResult
|
ToolResult with a |
ToolResult
|
Files that are missing or binary are skipped. |