treesitter-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@treesitter-mcpshow me the call graph for app.py"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Tree-sitter MCP Server & CLI
An MCP server and CLI that uses Tree-sitter to parse and analyze code.
What it does
Parse files and get their AST
Extract functions and variables
Build call graphs
Find where functions/variables are used
Run custom Tree-sitter queries
List imports/includes
Extract source code for specific line/column ranges
Use as a standalone CLI or as an MCP server for Claude Desktop
Related MCP server: code-analyze-mcp
Install
Requires Python 3.10+.
# Install directly
uv pip install treesitter-mcp
# Or install a specific version
uv pip install treesitter-mcp==2.1
# Or clone and install
git clone https://github.com/pwno-io/treesitter-mcp.git
cd treesitter-mcp
uv pip install -e .This installs both treesitter-mcp and ts-cli entry points.
Or run without installing:
uvx treesitter-mcpRunning
As an MCP server (default)
For use with Claude Desktop or other MCP clients:
treesitter-mcpSee docs/MCP_USAGE.md for how to configure.
Standalone CLI (ts-cli)
Run analysis directly from the terminal:
ts-cli path/to/file.py
ts-cli path/to/file.py --ast --max-depth 2
ts-cli path/to/file.py --find-function main --include-source
ts-cli --supported-languagesUse --output-file to write results to JSON files instead of stdout.
HTTP mode
For testing or manual use:
treesitter-mcp --http --port 8000 --host 127.0.0.1Limiting tools
Only expose certain tools with --tools:
treesitter-mcp --http --port 8000 --tools treesitter_analyze_file,treesitter_get_astOr via URL query param: http://127.0.0.1:8000?tools=treesitter_analyze_file,treesitter_get_ast
Tools available:
treesitter_analyze_file- Basic analysistreesitter_get_ast- Full ASTtreesitter_get_call_graph- Function callstreesitter_find_function- Find function definitionstreesitter_find_variable- Find variablestreesitter_get_source_for_range- Extract source code for a rangetreesitter_get_supported_languages- What's supportedtreesitter_get_node_at_point- AST node at a line/columntreesitter_get_node_for_range- AST node for a rangetreesitter_cursor_walk- Walk tree with contexttreesitter_run_query- Custom Tree-sitter queriestreesitter_find_usage- Find symbol usagestreesitter_get_dependencies- Extract imports/includes
If you don't specify --tools, everything is exposed.
Writing output to file
All tools support an optional output_file parameter. When provided, the tool
writes its result directly to the specified file (as pretty-printed JSON) instead
of returning it. This is useful for large outputs like ASTs that could cause
context overload in agents.
Example:
# Returns result to file, minimal response to agent
treesitter_get_ast(file_path="large_file.py", output_file="~/output/ast.json")
# Returns: {"status": "written", "output_file": "/home/user/output/ast.json", "bytes_written": 123456}The tool will:
Automatically create parent directories if they don't exist
Expand
~to your home directoryWarn (to stderr) if overwriting an existing file
Return a minimal confirmation dict on success, or an error dict if writing fails
Including source code in results
The treesitter_find_function and treesitter_find_variable tools support an
optional include_source parameter. When set to True, each matched symbol
includes its source code in the result:
treesitter_find_function(file_path="server.py", name="main", include_source=True)
# Returns: {"query": "main", "matches": [{"name": "main", ..., "source": "def main():\n ..."}]}Language support
Language | analyze_file | get_ast | get_call_graph | find_function | find_variable | find_usage | get_dependencies |
C | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
C++ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Python | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
JavaScript | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
TypeScript | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Go | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Java | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
PHP | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Rust | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
Ruby | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
File extensions
Language | Extensions |
C |
|
C++ |
|
Python |
|
JavaScript |
|
TypeScript |
|
Go |
|
Java |
|
PHP |
|
Rust |
|
Ruby |
|
Docs
Available Tools
13 toolstreesitter_analyze_fileA
Analyze a source code file and extract symbols (functions, classes, etc.).
Args: file_path: Path to the source code file to analyze (supports .py, .c, .cpp, .h, .hpp) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - file_path: The analyzed file path - language: Detected programming language - symbols: List of extracted symbols (functions, classes, etc.) - errors: Any parsing errors encountered OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
Note: This function does not return the full AST to avoid serialization issues. Use treesitter_get_ast() if you need the complete AST.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full behavioral burden. It discloses that the function does not return the full AST due to serialization issues, can write results to a file, and returns a structured dictionary with specific fields. It also lists supported file extensions, providing valuable context beyond the bare schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured and concise: a one-sentence purpose, followed by clear Args/Returns sections and a note. Every sentence contributes useful information without redundancy or fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Despite no output schema, the description details the return dictionary structure. It also covers limitations, error handling ('errors' field), and alternative tool usage. Given the tool's simplicity (2 params, 1 required), the description is fully sufficient for an agent to select and invoke it correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description fully compensates: file_path is described as 'Path to the source code file to analyze (supports .py, .c, .cpp, .h, .hpp)' and output_file is explained as 'If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.' This adds significant meaning beyond the property names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: 'Analyze a source code file and extract symbols (functions, classes, etc.)'. It specifies the verb 'extract' and the resource 'source code file', and distinguishes itself from siblings by noting it returns symbols rather than the full AST.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly provides guidance on when to use an alternative: 'Use treesitter_get_ast() if you need the complete AST.' Also explains when to use the output_file parameter ('Useful for large outputs to prevent context overload'), giving clear context for choosing options.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_cursor_walkA
Return a cursor-style view (focus node + context) at a point.
Args: file_path: Path to the source code file row: Row number (0-based) column: Column number (0-based) max_depth: Maximum depth of the AST to return. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary with focus, ancestors, siblings, and children OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| row | Yes | ||
| column | Yes | ||
| file_path | Yes | ||
| max_depth | No | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full transparency burden. It discloses the output_file side effect ('writes result to this file instead of returning') and clearly describes the return shape or alternative written status. It does not mention error cases or file overwriting behavior, but the main behavioral traits are transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with Args and Returns sections, uses concise single-line explanations for each parameter, and includes only the necessary extra context about output_file. There is no fluff or redundancy; every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no annotations and no output schema, the description provides a solid foundation: purpose, all parameter semantics, and return shape. It is enough to invoke the tool correctly, but the return dictionary is only vaguely described as 'focus, ancestors, siblings, and children' without field types or structure, leaving some ambiguity for a complex AST tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has no parameter descriptions (0% coverage), but the description's Args section explains every parameter: file_path is a path, row/column are 0-based, max_depth controls AST depth, and output_file writes to a file instead of returning. This fully compensates for the schema gaps and adds useful context such as the rationale for output_file.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Return a cursor-style view (focus node + context) at a point.' It also lists the returned components (focus, ancestors, siblings, children), which clearly differentiates it from sibling tools like treesitter_get_node_at_point that likely return only a single node.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage through the 'cursor-style view' phrasing and provides a concrete guideline for the output_file parameter: 'Useful for large outputs to prevent context overload.' However, it does not explicitly state when to prefer this tool over alternatives or mention any exclusions, so it stops short of clear sibling differentiation.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_find_functionA
Search for a specific function definition by name.
Args: file_path: Path to the source code file name: Name of the function to find include_source: If True, includes the source code for each matched function. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - query: The search query (function name) - matches: List of Symbol objects representing matching function definitions. If include_source is True, each match includes a "source" field. OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| file_path | Yes | ||
| output_file | No | ||
| include_source | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses the output structure (query and matches), the include_source behavior, and the output_file side effect with rationale ('prevent context overload'). This goes beyond a simple 'search' statement, though it doesn't cover error cases or read-only guarantees. The behavioral details are valuable and missing from schema/annotations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is structured with Args and Returns sections and is front-loaded with a clear action. It is somewhat longer than necessary but each sentence provides useful context, such as the rationale for output_file. No filler or repetition.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 4 params, no output schema, and read-only intent, the description covers all key aspects: purpose, parameters, return format, conditional behavior, and alternate output method. It lacks explicit comparison to siblings, but that is a usage-guideline gap. Overall, it is complete enough for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has only titles and defaults (coverage 0%), so the description is the sole source of parameter meaning. It explains file_path, name, include_source with a clear condition, and output_file including its purpose and benefit. This fully compensates for the lack of schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Search for a specific function definition by name,' which clearly states the tool's precise action and target resource. It distinguishes from sibling tools like treesitter_find_variable or treesitter_find_usage by specifically limiting to function definitions.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use this tool (when you need a function definition by name) but gives no explicit alternatives or exclusions. It doesn't mention 'use treesitter_find_variable for variable lookup' or 'avoid this for AST queries.' Usage context is clear but not explicitly compared to siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_find_usageA
Find all usages/references of a symbol (identifier) in a source file.
Args: name: Symbol name to search for file_path: Path to the source code file language: Optional language override (auto-detected from file extension if not provided) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - query: The search query (symbol name) - matches: List of Symbol objects representing all usages of the symbol OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| language | No | ||
| file_path | Yes | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It clearly discloses the file-writing side effect of output_file and explains the two possible return shapes. It does not mention error cases or the internal structure of Symbol objects, but it gives a solid, honest behavioral overview.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is compact and well-structured with clear Args and Returns sections. Every sentence earns its place—no fluff, and the most important information is front-loaded in the first sentence.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given there is no output schema, the description does a good job of explaining the return format and the output_file alternative. It is slightly incomplete in that it does not describe the fields of Symbol objects or behavior on no matches, but it is sufficient for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description fully compensates by documenting all four parameters with meaningful semantics: name, file_path, language override, and the output_file behavior. This exceeds the baseline and makes the schema usable.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb and resource: 'Find all usages/references of a symbol (identifier) in a source file.' This clearly distinguishes it from sibling tools like treesitter_find_function and treesitter_find_variable, which focus on definitions rather than usages.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides practical guidance for the output_file parameter ('Useful for large outputs to prevent context overload') and explains the language auto-detection behavior. However, it does not explicitly state when to choose this tool over nearby alternatives such as treesitter_run_query or treesitter_find_variable, so the when-not guidance is missing.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_find_variableA
Search for variable declarations and usages by name.
Args: file_path: Path to the source code file name: Name of the variable to find include_source: If True, includes the source code for each matched variable. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - query: The search query (variable name) - matches: List of Symbol objects representing variable declarations and usages. If include_source is True, each match includes a "source" field. OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| file_path | Yes | ||
| output_file | No | ||
| include_source | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the burden of disclosing behavior. It explains the return dictionary and the output_file alternative, but it does not explicitly state that the operation is read-only, how errors are handled (e.g., file not found, no matches), or what Symbol objects contain beyond an optional 'source' field. This leaves notable behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with Args and Returns sections, opens with a clear one-line purpose, and each parameter and return detail is explained without redundancy. The 'Useful for large outputs' note adds value without bloating the text, and the whole description is appropriately sized for four parameters.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With no output schema and no annotations, the description covers all parameters and return values, including the output_file alternative. However, it omits details about the structure of Symbol objects, behavior when no matches exist, and error conditions, so it is not fully complete for a tool of this complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the parameter explanations in the description are critical. Each argument is given a meaningful description: file_path as 'Path to the source code file,' name as 'Name of the variable to find,' include_source as controlling source inclusion, and output_file as an alternative to returning. This fully compensates for the bare schema and adds significant semantics.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with 'Search for variable declarations and usages by name,' which specifies a concrete action (search), a resource (variable declarations/usages), and a qualifier (by name). This clearly distinguishes it from sibling tools like treesitter_find_function (functions) and treesitter_find_usage (general usage), making its purpose explicit and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description does not explicitly state when to choose this tool over alternatives like treesitter_find_usage or treesitter_find_function. Usage is implied from the purpose, and the only additional guidance is the note about output_file being useful for large outputs. No exclusions or alternative tool references are given, so guidance is limited to implied context.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_astA
Extract the complete Abstract Syntax Tree (AST) from a source file.
Args: file_path: Path to the source code file max_depth: Maximum depth of the AST to return. -1 for no limit (default). Useful for large files to avoid serialization errors. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary representing the AST root node with: - type: Node type (e.g., 'module', 'function_definition') - start_point: Starting position (row, column) - end_point: Ending position (row, column) - children: List of child AST nodes - text: Optional text content - id: Optional node identifier OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| max_depth | No | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It clearly explains the return format (dictionary with type, start_point, end_point, children) and the alternative behavior when output_file is set (writes to file and returns a status dictionary). It also hints at potential issues like serialization errors. However, it does not explicitly state whether the tool is read-only or discuss side effects, though it is implied by 'Extract'.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with a clear opening sentence, an Args section, and a Returns section. Every sentence provides value: the main purpose, parameter details, and return structure. It is concise given the amount of information needed and front-loads the primary action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with 3 parameters and no output schema, the description covers all necessary aspects: what the tool does, each parameter's role, return values, and edge-case behavior (output_file). It even notes practical limitations for large files. There are no significant gaps, making it highly complete for the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description compensates fully by explaining each parameter: file_path is 'Path to the source code file', max_depth is 'Maximum depth of the AST to return. -1 for no limit' with practical advice, and output_file is 'If provided, writes result to this file instead of returning' with rationale. This adds substantial meaning beyond the bare schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb and resource: 'Extract the complete Abstract Syntax Tree (AST) from a source file.' This clearly states the tool's function and distinguishes it from siblings like treesitter_get_node_for_range (which targets specific nodes) and treesitter_get_source_for_range (which retrieves source text).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear usage context for parameters, e.g., 'max_depth' is 'Useful for large files to avoid serialization errors' and 'output_file' is 'Useful for large outputs to prevent context overload.' It implies when to use these options, though it does not explicitly compare to alternative sibling tools or state when not to use the tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_call_graphA
Generate a call graph showing function calls and their relationships.
Args: file_path: Path to the source code file output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - nodes: List of CallGraphNode objects, each with: - name: Function name - location: Source location (start/end points) - calls: List of function names called by this function OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It thoroughly details the return structure and the alternate file-writing behavior, including the status dict. This is strong transparency for a read-only analysis tool, though it does not cover potential errors or edge cases.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is front-loaded with a clear one-sentence summary, followed by compact Args and Returns sections. It is concise, well-structured, and every sentence provides value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the core functionality, parameter effects, return format, and the alternative output mode, which is sufficient given the tool's simplicity and lack of an output schema. Minor gaps like error handling or language support are not critical for basic usage.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has no parameter descriptions (0% coverage), so the description's explanations of file_path and output_file add essential meaning. It goes beyond the schema by explaining the default behavior (returns graph) and the conditional behavior (writes to file and returns status).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it generates a call graph showing function calls and their relationships, using a specific verb and resource. This distinguishes it from sibling tools like treesitter_get_dependencies or treesitter_get_ast.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context on when to use the tool (to obtain a call graph) and gives a practical tip about using output_file for large outputs to prevent context overload. However, it does not explicitly mention alternative tools or when not to use it.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_dependenciesA
Extract all dependencies (imports/includes) from a source file.
Args: file_path: Path to the source code file output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: List of dependency strings: - For Python: import module names - For C/C++: included file paths (without quotes/brackets) OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It explains the return format for different languages (Python, C/C++) and the behavior of the output_file parameter (writes to file instead of returning). It also notes a key benefit (avoiding context overload). It does not mention error handling or unsupported languages, but the provided details are substantial.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a clear opening sentence, a brief args section, and a return section. It is concise (about 100 words) and every sentence provides useful information without fluff. The front-loading is effective.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (2 params, no output schema, no annotations), the description covers the essentials: what it does, how parameters work, and what the return value looks like. It could mention supported languages beyond Python and C/C++, but the core functionality is clearly documented.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must fully compensate. It does: file_path is described as 'Path to the source code file' and output_file is explained as 'If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.' This adds clear meaning beyond the bare schema types.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function with a specific verb+resource: 'Extract all dependencies (imports/includes) from a source file.' This distinctly sets it apart from sibling tools like treesitter_get_ast or treesitter_run_query, which serve different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides some usage context (e.g., output_file for large outputs to prevent context overload) but does not explicitly mention when to use this tool versus alternatives or when not to use it. The usage is implied by the tool's purpose, but no exclusions or alternative recommendations are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_node_at_pointA
Return the AST node covering a specific point (row, column).
Args: file_path: Path to the source code file row: Row number (0-based) column: Column number (0-based) max_depth: Maximum depth of the AST to return. 0 for just the node. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: AST node as dictionary OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| row | Yes | ||
| column | Yes | ||
| file_path | Yes | ||
| max_depth | No | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It explains the output_file behavior and its rationale (preventing context overload), the max_depth semantics, and the return format. It does not cover error cases or node selection logic when multiple nodes cover a point, but overall it is transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a one-sentence purpose, a concise Args list, and a Returns section. Every line adds value, and the output_file note is succinctly integrated. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the core functionality, all parameters, and the return format including the output_file alternative. Minor missing details include how overlapping nodes are resolved and error handling, but these are not critical for a read-only query tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description provides a clear explanation for each of the five parameters, including row/column being 0-based and the meaning of max_depth. This fully compensates for the input schema's lack of descriptions (0% coverage).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Return the AST node covering a specific point (row, column).' It uses a specific verb and resource, and the point-based scope distinguishes it from siblings like treesitter_get_node_for_range and treesitter_get_ast.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context for when to use the tool (querying a single point) but does not explicitly mention alternatives or exclusions. The context is sufficient for an agent to differentiate from range-based or whole-tree tools.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_node_for_rangeA
Return the smallest AST node covering a point range.
Args: file_path: Path to the source code file start_row: Starting row (0-based) start_column: Starting column (0-based) end_row: Ending row (0-based) end_column: Ending column (0-based) max_depth: Maximum depth of the AST to return. 0 for just the node. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: AST node as dictionary OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| end_row | Yes | ||
| file_path | Yes | ||
| max_depth | No | ||
| start_row | Yes | ||
| end_column | Yes | ||
| output_file | No | ||
| start_column | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It explains max_depth semantics, the output_file side effect (writes to file instead of returning), and the return format. It does not discuss error cases, but for a read-only operation this is sufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with a one-line summary, an Args list, and a Returns section. It is concise, front-loaded, and every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the absence of output schema and annotations, the description is complete: it covers the tool's purpose, all parameters, and return values including the alternative file-write mode. The only missing elements are edge-case error handling, which is not critical for typical use.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no descriptions for parameters, so the description's Args section is essential. It provides 0-based row/column details, max_depth meaning, and output_file behavior, covering all 7 parameters with actionable context beyond simple titles.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool 'Return the smallest AST node covering a point range,' using a specific verb and resource. It distinguishes itself from siblings like treesitter_get_node_at_point by specifying range coverage and 'smallest' node.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when a node spanning a range is needed, and the output_file option provides context for large outputs. However, it does not explicitly mention alternative tools or when not to use this tool, relying on inferred applicability.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_source_for_rangeA
Extract the source code text for a given line/column range.
Args: file_path: Path to the source code file start_row: Starting line number (0-based) start_column: Starting column number (0-based) end_row: Ending line number (0-based) end_column: Ending column number (0-based) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Dictionary containing: - file_path: The analyzed file path - range: The requested range - source: The extracted source code text OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| end_row | Yes | ||
| file_path | Yes | ||
| start_row | Yes | ||
| end_column | Yes | ||
| output_file | No | ||
| start_column | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description effectively discloses behavior by detailing both return modes (inline source text or writing to an output file) and the reason for the output_file mode. It also provides the 0-based indexing context for coordinates. However, it does not mention potential errors or edge cases like out-of-bounds ranges, which would be useful but not critical for this read-only operation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured, starting with a one-sentence purpose, followed by a clear Args list and Returns specification. It is compact without unnecessary fluff. The Args section repeats parameter names from the schema, but it's justified because it adds crucial detail about row/column conventions and output_file semantics.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of annotations and output schema, the description does a strong job of covering all parameters, both return modes, and the rationale for the output_file option. It stops short of defining range inclusivity (e.g., whether end_row/end_column are exclusive), which could lead to off-by-one errors. Overall, it is sufficiently complete for an experienced user.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema parameters are minimally described (e.g., 'End Row'), but the description attaches meaning to every parameter in the Args section, including their 0-based nature and the output_file behavior. This fully compensates for the 0% schema description coverage, making the parameters self-explanatory.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Extract the source code text for a given line/column range.' This specific verb and resource distinguish it from sibling tools like treesitter_get_node_for_range, which extracts AST nodes, and treesitter_run_query, which runs queries. The scope is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage when raw source text for a range is needed, but it does not explicitly mention when to use this tool over alternatives like get_node_for_range or cursor_walk. It does provide a specific guideline for the output_file parameter (useful for large outputs to prevent context overload), but lacks broader contextual guidance or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_get_supported_languagesA
Get a list of programming languages supported by the analyzer.
Args: output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: List of supported language names (e.g., ['python', 'c', 'cpp']) OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It clearly explains two possible behaviors: returning a list of languages, or writing to a file if output_file is set, including the exact return structure in both cases. It also notes the rationale for output_file ('prevent context overload'), which adds useful behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured: a one-line summary followed by Args and Returns sections. Despite being longer than a single-sentence description, every sentence earns its place, and the most important information (purpose and return) is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one optional parameter and no output schema, the description is complete. It covers purpose, parameter semantics, and both possible return shapes. No important information is missing.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description fully compensates. It explains the output_file parameter's meaning (writes to file instead of returning), its use case (large outputs), and the resulting return value. This adds far more context than the bare schema (a string/null parameter with no description).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a clear, specific verb: 'Get a list of programming languages supported by the analyzer.' It names the resource (supported languages) and uniquely distinguishes this tool from siblings that focus on AST traversal, queries, and analysis.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Usage guidance is only implied. The tool's purpose is obvious from the description, but it never explicitly states when to use this tool versus alternatives or mentions any context or prerequisites. The output_file parameter description gives a minor usage hint for large outputs, but no overall usage guidelines.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
treesitter_run_queryA
Execute a custom Tree-sitter query against a source file.
Args: query: Tree-sitter query string in S-expression format file_path: Path to the source code file language: Optional language override (auto-detected from file extension if not provided) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.
Returns: Query results as a dictionary or list, depending on the query structure OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| language | No | ||
| file_path | Yes | ||
| output_file | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It explains the output_file behavior (writes to file instead of returning) and mentions the return type depends on query structure. However, it does not mention error handling, side effects, or whether the tool is read-only, leaving gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured with Args and Returns sections, each sentence serving a purpose. It is concise yet covers all essential behavioral and parameter details without redundancy, making it easy to parse.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity and lack of annotations or output schema, the description covers return types, parameter behaviors, and the output_file option adequately. It does not include examples or deeper syntax explanation, but this is not critical for a query execution tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description compensates well. It provides meaningful info for each parameter: query format (S-expression), language auto-detection, output_file purpose. This adds value beyond the schema, though file_path is minimally described.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: 'Execute a custom Tree-sitter query against a source file.' This is a specific verb+resource combination and distinguishes it from sibling tools by emphasizing 'custom' queries, as opposed to specialized operations like finding usages or getting an AST.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for custom queries not covered by other tools but does not explicitly state when to use this tool vs alternatives. It provides no exclusions or direct comparisons to sibling tools, leaving the usage context somewhat implied.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
13 tool updates
v0.1.0- First observed
treesitter_analyze_file - First observed
treesitter_cursor_walk - First observed
treesitter_find_function - First observed
treesitter_find_usage - First observed
treesitter_find_variable - First observed
treesitter_get_ast - First observed
treesitter_get_call_graph - First observed
treesitter_get_dependencies - First observed
treesitter_get_node_at_point - First observed
treesitter_get_node_for_range - First observed
treesitter_get_source_for_range - First observed
treesitter_get_supported_languages - First observed
treesitter_run_query
TDQS
Scored across 13 tools
get_node_for_range and get_node_at_point are nearly identical since a point is a zero-length range. find_function, find_variable, and find_usage all search by symbol name and return Symbol objects, differing only in the type of symbol. cursor_walk also provides node context at a point, overlapping with get_node_at_point, making boundaries unclear.
All tools follow a consistent treesitter_ prefix with snake_case and a verb-object structure (get_, find_, run_, analyze_). The only minor deviation is cursor_walk, which inverts the typical verb-object order but remains clear and easy to parse.
13 tools is well within the ideal range for a code analysis server. Each tool addresses a distinct aspect of Tree-sitter functionality (AST, queries, symbols, dependencies, call graph) without bloat or excessive redundancy.
The server covers core workflows: AST inspection, query execution, symbol lookup, dependency extraction, call graph generation, and language support. Minor gaps include a unified symbol search (function and variable tools could be merged) and a more direct node navigation tool, though cursor_walk partially fills that need.
Maintenance
Related MCP Connectors
Repository knowledge graph MCP server for codebase understanding and debugging.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA runtime-free MCP server that converts source code into AST🌲, regardless of language.86MIT
- AlicenseNot gradedqualityAmaintenanceStandalone MCP server for code structure analysis using tree-sitter. Directory trees, symbol definitions, and call graphs without reading raw source files. Supports Rust, Python, Go, Java, TypeScript, Fortran, JavaScript, C/C++, and C#. Benchmarked up to 68% fewer tokens vs native tools.6Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA modular MCP server for code analysis using ast-grep, enabling structural pattern matching and transformations across multiple languages.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that indexes your codebase using tree-sitter AST parsing and gives AI tools instant access to structural intelligence like dependency graphs, call trees, and dead code detection from a local SQLite database.MIT