ast-mcp

v0.7.2
ast-mcp Checked 2 days ago Published 1 month ago

Structural code retrieval over MCP — tree-sitter symbols instead of whole files

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

file_outline

Outline one file: definitions, key paths or headings, bodies elided. Use this instead of reading a file to find out what is in it. mode: "full" (default) or "names" — names, lines and counts only, for enumerating what a file defines. On a data file this answers record count and field types without returning any value from inside a collection: each collection carries `children_count` and `uniformity` ("uniform" — every element has element 0's keys; "mixed" — they differ; "unverified" — too many to check).

ParameterTypeDescription
path *string
include_docstringsboolean
max_depth
max_tokensinteger
modestring

get_symbol

Fetch definitions by name, key path, or heading slug. mode: "source" (default) returns the body, "signature" and "doc" omit it. A name matching several different symbols returns candidates rather than guessing. A name matching several definitions of the same thing — many Lua listeners on one event — returns all of them in "symbols". line: pick one definition by the start_line a candidate reported.

ParameterTypeDescription
name *string
line
max_tokensinteger
modestring
path

search_symbols

Find definitions, key paths and headings by name across the repository. group is one of core, web, scripting, data, devops, docs.

ParameterTypeDescription
query *string
group
kind
lang
limitinteger
max_tokensinteger
path_glob

get_docstrings

Documentation without bodies. Pass exactly one of path or symbols.

ParameterTypeDescription
max_tokensinteger
path
symbols

list_imports

Dependency edges out of one file, plus exports where the language has them.

ParameterTypeDescription
path *string
max_tokensinteger

ast_query

Run a raw tree-sitter S-expression query against one file. The escape hatch for anything the five typed tools flatten away.

ParameterTypeDescription
path *string
query *string
captures
max_tokensinteger