Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

treesitter_run_query

Execute a Tree-sitter query against source code to find syntax patterns. Specify query and file path; optionally set language or write results to an output file.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
languageNo
file_pathYes
output_fileNo
Behavior3/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 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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

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