Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

treesitter_find_variable

Find variable declarations and usages by name in source code. Locate every reference, with optional source snippets, to analyze or debug quickly.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
file_pathYes
output_fileNo
include_sourceNo
Behavior3/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

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