/** * Real handler for `get_symbol_context` — the primitive MCP tool. * * Single-symbol mode (legacy): caller passes `symbol: string`. Input is * parsed, the symbol is resolved (full ID or plain name with optional * file_hint), the bundle is assembled via src/queries/symbol-context.ts, * and the result is rendered compact-by-default (ADR-04) or JSON. * Disambiguation / not_found / no_adapter map to whole-call * `isError: true`. Output is byte-identical to the pre-ADR-15 * implementation — guarded by the byte-equivalence test in * src/mcp/server.test.ts. * * Multi-symbol mode (ADR-15): caller passes `symbol: string[]` (up to * MAX_SYMBOLS_PER_CALL items). Input strings are .trim()-normalized * and exact-match-deduped before resolution; resolution fans out per * input; per-symbol failures inline as ERR sub-bundles; whole-call * `isError: true` only when EVERY input failed. Compact output uses * named delimiters (`--- get_symbol_context: (N of M) ---`); * JSON output uses a `{ results: [{ symbol, bundle, error }, ...] }` * envelope. Order matches request order. * * Implementation note on JSON shape symmetry: in JSON mode the all-failed * case uses the same `{ results: [...] }` envelope as the partial-failure * case — the only signal distinguishing them is the JSON-RPC response's * `isError: true` flag plus the consumer walking `results` for non-null * `error` entries. The compact-format `ERR all_symbols_failed COUNT ` * summary header has no JSON analogue; that is a compact-only affordance. */ import { type CallToolRequest, type CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import type { DatabaseInstance } from "../../storage/db.js"; import type { LanguageAdapter, LanguageCode } from "../../types.js"; export interface HandlerDeps { db: DatabaseInstance; adapters: ReadonlyMap; /** * Hotness threshold + recent-commits cap (ADR-11). Mirrors * `config.git.recentCommits`. Passed through to `buildBundle`. */ gitRecentCommits: number; /** * BM25 ranking opt-in (v0.3 Theme 1.2 Fix 3, ADR-16; v0.8 Step 1 * activation-layer amendment). When true, `get_symbol_context` * ranks the intent block via FTS5 BM25 — caller-provided `query` * wins when present, otherwise the handler synthesizes a query * from the resolved `symbol.name` (closes the v0.3→v0.7 dormancy * gap documented in ADR-16 Limitations / 2026-05-14 amendment). * Mirrors `config.mcp.symbolContextBM25`. Defaults to false; * flag-off is byte-equivalent to v0.2 ranking (severity → source * → claim_id), guarded by the v0.2-equivalence canary tests. */ symbolContextBM25?: boolean; } export declare function createGetSymbolContextHandler(deps: HandlerDeps): (request: CallToolRequest) => Promise; //# sourceMappingURL=get-symbol-context.d.ts.map