Skip to main content
Glama
pwno-io

treesitter-mcp

by pwno-io

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
treesitter_analyze_fileA

Analyze a source code file and extract symbols (functions, classes, etc.).

Args: file_path: Path to the source code file to analyze (supports .py, .c, .cpp, .h, .hpp) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: Dictionary containing: - file_path: The analyzed file path - language: Detected programming language - symbols: List of extracted symbols (functions, classes, etc.) - errors: Any parsing errors encountered OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

Note: This function does not return the full AST to avoid serialization issues. Use treesitter_get_ast() if you need the complete AST.

treesitter_get_call_graphA

Generate a call graph showing function calls and their relationships.

Args: file_path: Path to the source code file output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: Dictionary containing: - nodes: List of CallGraphNode objects, each with: - name: Function name - location: Source location (start/end points) - calls: List of function names called by this function OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

treesitter_find_functionA

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}

treesitter_find_variableA

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}

treesitter_get_supported_languagesA

Get a list of programming languages supported by the analyzer.

Args: output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: List of supported language names (e.g., ['python', 'c', 'cpp']) OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

treesitter_get_astA

Extract the complete Abstract Syntax Tree (AST) from a source file.

Args: file_path: Path to the source code file max_depth: Maximum depth of the AST to return. -1 for no limit (default). Useful for large files to avoid serialization errors. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: Dictionary representing the AST root node with: - type: Node type (e.g., 'module', 'function_definition') - start_point: Starting position (row, column) - end_point: Ending position (row, column) - children: List of child AST nodes - text: Optional text content - id: Optional node identifier OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

treesitter_get_node_at_pointA

Return the AST node covering a specific point (row, column).

Args: file_path: Path to the source code file row: Row number (0-based) column: Column number (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}

treesitter_get_node_for_rangeA

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}

treesitter_cursor_walkA

Return a cursor-style view (focus node + context) at a point.

Args: file_path: Path to the source code file row: Row number (0-based) column: Column number (0-based) max_depth: Maximum depth of the AST to return. output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: Dictionary with focus, ancestors, siblings, and children OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

treesitter_get_source_for_rangeA

Extract the source code text for a given line/column range.

Args: file_path: Path to the source code file start_row: Starting line number (0-based) start_column: Starting column number (0-based) end_row: Ending line number (0-based) end_column: Ending column number (0-based) output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: Dictionary containing: - file_path: The analyzed file path - range: The requested range - source: The extracted source code text OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

treesitter_run_queryA

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}

treesitter_find_usageA

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}

treesitter_get_dependenciesA

Extract all dependencies (imports/includes) from a source file.

Args: file_path: Path to the source code file output_file: If provided, writes result to this file instead of returning. Useful for large outputs to prevent context overload.

Returns: List of dependency strings: - For Python: import module names - For C/C++: included file paths (without quotes/brackets) OR if output_file is set: {"status": "written", "output_file": "...", "bytes_written": N}

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

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