Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

treesitter_get_node_for_range

Identify the smallest AST node covering a range in code, specified by start/end rows and columns.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_rowYes
file_pathYes
max_depthNo
start_rowYes
end_columnYes
output_fileNo
start_columnYes
Behavior4/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pwno-io/treesitter-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server