Skip to main content
Glama
kvnpetit

SRC (Structured Repo Context)

by kvnpetit

query_code

query_code
Read-onlyIdempotent

Find code patterns by running Tree-sitter queries on files or content, using preset queries for functions, classes, imports, exports, comments, strings, variables, and types, or custom SCM patterns.

Instructions

Execute Tree-sitter SCM queries on code to find patterns. Use preset queries (functions, classes, imports, exports, comments, strings, variables, types) or custom SCM query patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryNoSCM query pattern (either query or preset required)
presetNoPreset query name: functions, classes, imports, exports, comments, strings, variables, types
contentNoCode content to query directly (either file_path or content required)
languageNoLanguage name (auto-detected from file path if not provided)
file_pathNoPath to the file to query (either file_path or content required)
max_matchesNoMaximum number of matches to return (default: 500)
redact_secretsNoRedact common secrets in query match text (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.1/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and destructiveHint=false, so the safety profile is covered. The description adds no additional behavioral context beyond what the schema provides (e.g., redact_secrets default). It does not contradict annotations but also does not enrich them.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the core action. However, it is minimal and does not structure the information (e.g., separating preset vs. custom usage), so it is adequate but not exemplary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 7 parameters, an output schema, and full schema coverage. The description covers the main use case but lacks guidance on tool selection, error scenarios, or performance considerations. Given the complexity and sibling context, the description is functional but not fully complete.

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%, so parameters are fully documented there. The description mentions presets and custom patterns, which overlaps with the schema's preset enum and query description, but adds no new meaning beyond the schema. Baseline 3 is appropriate.

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 clearly states the action ('Execute Tree-sitter SCM queries') and the resource ('code to find patterns'), and mentions both preset and custom queries. It is distinct from sibling tools like search_code or parse_ast, though it does not explicitly name alternatives.

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 use this tool versus siblings such as search_code, parse_ast, or list_symbols. The description implies use for pattern detection but does not provide selection criteria or exclusions, which is a gap given the large sibling list.

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