Skip to main content
Glama
kvnpetit

SRC (Structured Repo Context)

by kvnpetit

parse_ast

parse_ast
Read-onlyIdempotent

Parse code from file paths or raw content into an Abstract Syntax Tree, supporting multiple languages for structural inspection.

Instructions

Parse code and return the Abstract Syntax Tree (AST). Supports multiple languages including JavaScript, TypeScript, Python, Go, Rust, Java, C, C++, and more.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentNoCode content to parse directly (either file_path or content required)
languageNoLanguage name (auto-detected from file path if not provided)
file_pathNoPath to the file to parse (either file_path or content required)
max_depthNoMaximum depth of AST to return (default: 5)
max_nodesNoMaximum AST nodes materialized in the response (default: 10000)
max_text_bytesNoMaximum UTF-8 text retained per AST node (default: 2000)
redact_secretsNoRedact common secrets in AST text fields (default: true)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
metaYes
errorNo
messageNo
successYes
schema_versionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.0

TDQS

A3.6/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnly, idempotent, and non-destructive behavior, so the description doesn't need to repeat safety traits. It adds language-scope context but discloses no other runtime behavior (e.g., truncation, redaction defaults) – though those are covered in the schema. No contradiction.

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?

A single, front-loaded sentence states the core function before listing supported languages. No filler or redundant restatement of the tool name.

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 a rich schema, full parameter descriptions, output schema, and annotations, the description is mostly sufficient for correct invocation. It does not state the file_path-or-content precondition or usage trade-offs, but these are either in the schema or covered by other dimensions.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, and each parameter (content, language, file_path, max_depth, max_nodes, max_text_bytes, redact_secrets) has its own description. The tool description adds no parameter-level meaning beyond the schema, so baseline 3 applies.

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: 'Parse code and return the Abstract Syntax Tree (AST)' – a clear, unambiguous purpose. The language list distinguishes it from sibling search/index/analysis tools, even though it doesn't name them. 'And more' is minor imprecision but doesn't undermine clarity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to choose parse_ast over siblings like search_code, analyze_file, or query_code. The description only states capability ('Supports multiple languages') and gives no conditions, exclusions, or alternative routing.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.