Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

treesitter_find_usage

Find all usages and references of a symbol in a source file. Automatically detects the language or accepts an override, and can write large outputs to a file.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
languageNo
file_pathYes
output_fileNo
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

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