Skip to main content
Glama
kvnpetit

SRC (Structured Repo Context)

by kvnpetit

analyze_file

analyze_file
Read-onlyIdempotent

Analyze a source code file to extract symbols, imports, exports, and code metrics, with optional AST for deeper structural understanding.

Instructions

Perform a comprehensive analysis of a source code file. Returns symbols, imports, exports, and code metrics. Optionally includes the full AST.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the file to analyze
include_astNoInclude full AST in response (default: false, can be verbose)
ast_max_depthNoMaximum depth for AST if included (default: 5)
ast_max_nodesNoMaximum AST nodes if included (default: 10000)
include_chunksNoInclude text chunks for fallback parsing (default: false)
redact_secretsNoRedact common secrets in structured source fields (default: true)
include_exportsNoInclude export statements (default: true)
include_importsNoInclude import statements (default: true)
include_symbolsNoInclude extracted symbols (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

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, and the description aligns with them—no contradiction. The description adds the high-level behavioral context that it returns symbols, imports, exports, metrics, and optionally the AST. It does not go further into performance implications or output size warnings, though the schema already warns about AST verbosity. With the safety profile covered by annotations, this is a solid but not exceptional disclosure.

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 a single, front-loaded sentence covering the core action, primary outputs, and an optional enhancement. Every clause contributes information; there is no filler, repetition, or unnecessary detail. Extremely efficient and scannable.

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 the rich input schema, output schema, and non-destructive annotations, the description is nearly complete for correct invocation. The main gap is the lack of explicit differentiation from closely related siblings, which is the same weakness as purpose clarity and usage guidelines. Still, the description plus schema and annotations provide enough information for an agent to call analyze_file effectively.

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?

The input schema has 100% parameter description coverage and includes defaults and limits for all nine parameters. The description adds no meaningful parameter details beyond mentioning the optional full AST, which the schema already explains. Baseline 3 applies because the schema carries the semantic weight and the description doesn't need to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource ('Perform a comprehensive analysis of a source code file') and enumerates returned data (symbols, imports, exports, code metrics, optional AST). This makes the main purpose clear. However, it does not distinguish itself from siblings like parse_ast, list_symbols, or run_static_analysis, so an agent could still be uncertain which tool to pick.

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?

There is no guidance about when to use analyze_file versus the many sibling tools. The description only states what the tool does, not when it is preferable to parse_ast or list_symbols, nor any exclusions or alternatives. An agent is left to infer the intended use case from the descriptive language alone.

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