Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

treesitter_find_function

Locate function definitions by name in source files. Returns matches with optional source code, or writes output to a file to avoid context overload.

Instructions

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}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
file_pathYes
output_fileNo
include_sourceNo
Behavior4/5

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.

Conciseness4/5

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.

Completeness4/5

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.

Parameters5/5

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.

Purpose5/5

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.

Usage Guidelines3/5

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.

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