tree-lens
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| TREE_SITTER_MCP_ROOTS | No | Workspace roots for path confinement. If unset, uses host-advertised roots or nearest project markers. | |
| TREE_SITTER_MCP_ALLOW_UNCONFINED | No | Set to '1' to allow paths with no project marker to be accessed. |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_definitionsA | List definitions (classes, functions, methods, fields, structs...) in a source file with name, kind and line ranges. Structural alternative to reading the whole file. |
| read_definitionA | Read the source code of one definition (method/class/function...) by exact name from a source file. Overloads and same-named definitions are all returned with line numbers. |
| ast_searchA | Run a tree-sitter query (S-expression pattern) against a source file and return captures with line numbers. Use for AST-shaped matching that Grep cannot express. |
| index_workspaceA | Parse all supported source files under a directory into a persisted symbol index (definitions + identifier occurrences + call sites), backed by SQLite when available (JSON fallback). Run once before find_references / go_to_definition. Indexes are kept per root: indexing a new root adds a second index instead of replacing the existing one. |
| delete_indexA | Drop a workspace symbol index built by index_workspace: removes it from the current session and deletes its persisted cache files (SQLite db / JSON) so the next index_workspace rebuilds from scratch. Omit root when exactly one index exists; with several indexes you must pass root. Non-destructive to source files — only cache is removed. |
| find_referencesA | Occurrences of an identifier across the indexed workspace, marking definition sites. References are classified with confidence tiers: exact (import-resolved or local), likely (same-dir or unique name), name (fallback). If the index for root does not exist yet it is built automatically (first call may be slow). |
| go_to_definitionA | Definition sites of a name across the indexed workspace, nearest to the optional |
| index_statusA | Report current workspace index state: root, version, totals, watcher active, pending dirty paths. Without root, reports the most recently built index plus all available roots. |
| list_presetsB | List built-in and user-provided audit query presets per language (eval/exec, subprocess shell, innerHTML, System.exit, os/exec...). |
| preset_searchA | Run a named preset (see list_presets) against a source file and return capture hits with line numbers. |
| get_node_typesA | List named node types, anonymous tokens and field names for a language's grammar — use it to write correct ast_search query patterns without trial and error. |
| analyze_complexityA | Approximate cyclomatic complexity (1 + decision points: if/loops/case/catch/&&/||/ternary) per function in a source file, worst first. |
| callersA | Heuristic (name-based) call sites of a function in the indexed workspace: each hit gives file, line, language, enclosing caller function and receiver object, plus a confidence tier (exact when the receiver's declared type or an import resolves the callee, likely for same-dir/unique names, name as fallback). Same-named methods of different classes are mixed in one result; filter by resolved_to for a precise call graph. Accepts optional file/language filters. If the index for root does not exist yet it is built automatically. |
| calleesA | Heuristic (name-based) call sites inside a function's body, grouped per callee name, with file, language, receiver object and a confidence tier (exact/likely/name) for the callee resolution. Same-named callees of different classes are grouped under one name; use the resolved_to fields to disambiguate. Accepts optional file/language filters. If the index for root does not exist yet it is built automatically. |
| resolution_statsA | Aggregate resolution statistics over the indexed workspace: share of call sites resolved at each confidence tier (exact/likely/name), how import names resolve, and how many names are defined in several files. Use it to measure, not assert, how well cross-file navigation works on a given codebase. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 15 tools
Most tools target clearly distinct operations (read vs list vs search vs index), and descriptions include enough detail to separate them. Minor overlap exists between find_references/callers and go_to_definition/read_definition, but the descriptions identify different granularities and index dependencies.
All tool names use consistent snake_case with a clear verb_noun or noun form (list_definitions, index_workspace, preset_search, callers, callees). No mixed conventions or vague generic verbs appear.
15 tools is well within the appropriate range for a code-analysis server: file-level reading/querying, workspace indexing, reference resolution, call-graph helpers, and presets each have a clear place. The count feels deliberate rather than padded.
The surface covers the domain well: per-file definitions, AST queries, presets, indexing lifecycle, reference/definition lookup, and call-graph analysis. A minor gap is the lack of workspace-wide AST/search operations and no listing of files/symbols across the workspace, but agents can work around those with existing tools.