codebase-snapshot

· 4 min read · by

MCP tools

The server exposes 7 tools. This page is the reference: what each answers, what it costs, and a call it accepts. Every read-only tool works against the live index by default: a current manifest.json is reused, changed files are overlaid in memory, and a repository with no snapshot is scanned without writing one. Pass "live": false to require the persisted snapshot.

snapshot_generate is the only writable tool. Every structured response carries a trust envelope with indexSource, freshness, coverage, redaction and omission counts, and named reasons when coverage is partial.

The seven tools

Cost: medium · Read-only: yes

What a change reaches: changed files, symbol-pruned transitive importers, routes, candidate tests, unresolved internal imports, optional outgoing imports and import cycles. Barrel re-exports are parsed; a consumer of a different symbol is not reported. Test files stay out of affected[] and appear in tests[].

{
  "name": "snapshot_impact",
  "arguments": {
    "paths": ["src/impact.ts"],
    "includeCycles": true,
    "includeSnippets": true
  }
}

Omit paths and base to compare the working tree with HEAD. symbols seeds explicit symbols; precise adds compiler-resolved references; depth (1–8) and maxResults bound the walk.

Cost: medium · Read-only: yes

The minimum redacted, line-numbered context for a question, file list, symbol list or explicit line ranges inside a hard token budget. An explicit symbol starts at its parsed declaration span; a range is numbered from its real start line. planOnly returns the ranked reading plan without bodies. Every requested file that does not fit is named in omitted[]. Hidden instructions and invisible characters are removed, and the response carries a receipt with chunk hashes and a canonical digest; signReceipt adds an Ed25519 signature when a signing key is configured.

{
  "name": "snapshot_context",
  "arguments": {
    "question": "how does impact pruning work",
    "maxTokens": 12000,
    "linesPerFile": 100
  }
}

A precise request uses the same tool:

{
  "name": "snapshot_context",
  "arguments": {
    "ranges": [{ "path": "src/impact.ts", "startLine": 180, "endLine": 240 }],
    "maxTokens": 4000
  }
}

Cost: cheap · Read-only: yes

Find paths, symbols, routes, entrypoints or text in one call. Text mode reads redacted bodies and is bounded to 4 MiB. Regex mode passes the same ReDoS guard as the rest of the server. For a symbol, includeReferences adds compiler-resolved references with confidence: "ts-semantic".

{
  "name": "snapshot_locate",
  "arguments": { "query": "parseImpact", "by": "symbol" }
}

Cost: medium · Read-only: yes

A line window of one redacted file. A sensitive path (.env, *.pem, .npmrc, .ssh/, .tfstate) is refused even when the path exists on disk, and a response never exceeds 64 KiB.

{
  "name": "snapshot_read",
  "arguments": { "path": "src/impact.ts", "fromLine": 1, "lines": 120 }
}

Cost: cheap · Read-only: yes

Three questions in one tool:

{
  "name": "snapshot_validate",
  "arguments": { "mode": "drift" }
}

A missing snapshot is an answer (present: false) in status and drift mode, not a tool failure.

Cost: expensive · Read-only: yes

Why a path is included, excluded, sensitive, ignored, binary or truncated. included: false is a successful explanation, not an error.

{
  "name": "snapshot_explain",
  "arguments": { "path": ".env" }
}

Cost: expensive · Writable: yes

Write the snapshot, or preview it with dryRun: true. This is the only tool that writes; it never installs packages and never edits configuration. It accepts the generation options the CLI accepts, including slice, budgetTokens, pack, stripComments, removeEmptyLines, skeleton, sarif, changedSince, staged and withDependents.

{
  "name": "snapshot_generate",
  "arguments": { "dryRun": true }
}

Types and visibility

The exact JSON Schemas are served by tools/list. Inputs reject unknown properties. Every tool accepts root and outDir; both are confined to the directories the server was started for. includeSensitiveFiles is deliberately absent from every tool: a prompt cannot turn a read-only server into an exfiltration primitive.

Removed tools and their replacements

Removed Use instead
snapshot_status, snapshot_stats, snapshot_review snapshot_validate({ mode: "status" })
snapshot_health snapshot_validate({ mode: "audit", deep: true })
snapshot_plan snapshot_generate({ dryRun: true })
snapshot_dependents, snapshot_neighbors, snapshot_tests, snapshot_diff_context, snapshot_cycles snapshot_impact
snapshot_plan_for, snapshot_answer, snapshot_budget snapshot_context
snapshot_search, snapshot_symbol, snapshot_query, snapshot_routes, snapshot_entrypoints snapshot_locate
snapshot_history snapshot://reports/log resource
snapshot_workspace WORKSPACE.json and the CLI

See also