Code intelligence
Choose the smallest AST-aware tool that answers the question.
ast-mcp exposes native intelligence tools directly. There is no generic proxy and no need to retrieve entire source files just to understand structure.
Learn the shape
| Tool | Use it for |
|---|---|
digest | A compact map of an unfamiliar directory |
map | Signatures, fields, headings, and parse health for exact files |
show | v2 symbol bodies across files, directories, or authorized globs |
surface | The public API after re-export resolution |
context | One symbol plus nearby callers and callees within a token budget |
show accepts file, directory, and glob targets plus an optional limit. Its JSON response is exclusively ast-mcp.show.v1, with files[], files_scanned, total, shown, truncated, coverage details, and Markdown frontmatter symbols. ast-mcp validates a glob's fixed prefix and every match before execution. Authorized zero-match globs return an empty v2 response.
Find behavior
| Tool | Question |
|---|---|
search | Where is this concept or symbol implemented? |
find_related | What code is structurally or semantically similar to this location? |
callers | Who calls this symbol? |
callees | What does this symbol call? |
trace | How does one symbol reach another? |
implements | Which types implement or extend this type? |
Understand dependencies
depsfollows imports forward.reverse_depsfinds importers.graphreturns the file dependency graph.cyclesidentifies strongly connected components.impactcombines call edges, imports, and affected tests for a proposed change.
Search and rewrite syntax
run uses structural syntax patterns. $NODE matches one node and a metavariable beginning with three dollar signs matches zero or more nodes.
Search omits rewrite. A dry-run includes rewrite and leaves write false. write: true fails with use_file_patch; commit edits through guarded file_patch batches.
Guarded structural patches require a fresh hash by default. Supply an explicit expected match count for each reviewed rule.
Bounded coverage
Bulk scans return available results when source-size, aggregate source-byte, or parsed-data budgets omit files. Coverage reports omission reasons, total counts, and bounded example paths. Inspect incomplete, exhaustive, and truncated before interpreting absent search matches or graph edges. Dependency, digest, search, and graph consumers preserve incomplete status. Narrow the root or paths to obtain complete evidence.
An oversized exact-file request still returns a typed error. Mutation reference verification remains strict and does not treat partial intelligence as proof of safety.