Skip to main content
Glama
kvnpetit

SRC (Structured Repo Context)

by kvnpetit

Get code snippet

get_code_snippet
Read-onlyIdempotent

Retrieve bounded source code by exact byte offsets, including line and column positions, for safe repository context extraction without execution.

Instructions

Read-only bounded source retrieval by exact UTF-8 byte offsets, with line/column positions and no code execution.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoProject root.
file_pathYesFile path relative to directory
max_bytesNoMaximum returned UTF-8 bytes
end_offsetNoExclusive UTF-8 byte offset
start_offsetNoInclusive UTF-8 byte offset
redact_secretsNoRedact common secrets; offsets remain those of the original file

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

A4.2/5.0
Behavior4/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 valuable context beyond annotations: retrieval is bounded by byte offsets, returns line/column positions, and guarantees no code execution. This is meaningful behavioral detail for an agent deciding whether to invoke it.

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, dense, front-loaded sentence that conveys the core mechanism (byte offsets), the output (line/column), and the key safety property (no execution). Every element earns its place; there is no filler.

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 output schema exists and annotations cover the safety profile, the description needn't explain return values. The byte-offset, bounded-retrieval, no-execution details are enough for an agent to select and invoke it. A small gap is the absence of guidance on non-UTF-8 files or behavior when offsets are invalid, but these are minor given the schema's clarity.

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 the schema documents all six parameters including defaults and maximum values. The description adds the 'exact UTF-8 byte offsets' framing, which clarifies the offset semantics, but for the most part the schema already carries the parameter documentation weight. Baseline 3 is appropriate.

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 states a specific verb ('retrieval'), precise resource (source code), and unique mechanism (exact UTF-8 byte offsets with line/column positions). It also differentiates itself from read siblings by emphasizing no code execution, which matters for tools like parse_ast or analyze_file.

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

Usage Guidelines4/5

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

The description implies use when you need bounded source retrieval by exact byte offsets, and the read-only/no-execution phrasing distinguishes it from analysis tools. However, it doesn't explicitly state when to prefer alternatives like search_code or get_symbol_at_position, leaving some inference to the agent.

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