/** * MCP Context Tools — signal-over-noise retrieval for MCP agents. * * Two tools that let any MCP client (Claude Code, Codex, Gemini CLI, Cursor) * pull *curated* shared state instead of dumping the whole blackboard into * its own context window: * * - `context_pack` — "give me everything relevant to task X in * ≤ N tokens": a token-budgeted, relevance-ranked, position-aware * context brief assembled by {@link ContextComposer} from the agent's * scoped blackboard snapshot. * - `blackboard_search` — ranked top-K search over blackboard entries. * Uses a semantic ranker when one is wired (BYOE `SemanticMemory`), * falling back to deterministic lexical overlap scoring otherwise — * always works out of the box. * * Implements the same `McpToolProvider` contract as the other tool modules, * so it registers directly on `McpCombinedBridge`. * * @example * ```typescript * const contextTools = new ContextMcpTools({ blackboard }); * combined.register(contextTools); * // MCP client: context_pack { task: "fix the parser bug", budget_tokens: 1500, agent_id: "claude-code" } * ``` * * @module mcp-tools-context * @version 1.0.0 */ import type { MCPToolDefinition, BlackboardToolResult, IBlackboard } from './mcp-blackboard-tools'; import { ContextComposer, type SemanticSearchLike } from './context-composer'; /** Options for {@link ContextMcpTools}. */ export interface ContextMcpToolsOptions { /** The blackboard to compose/search over (required) */ blackboard: IBlackboard; /** * Optional BYOE semantic memory. When provided, `blackboard_search` and * `context_pack` rank by embedding similarity; otherwise both fall back * to deterministic lexical scoring. */ memory?: SemanticSearchLike; /** Optional pre-configured composer (default: `new ContextComposer()`) */ composer?: ContextComposer; /** Default token budget for `context_pack` when the caller omits one (default 2000) */ defaultBudgetTokens?: number; /** Hard ceiling on any requested budget (default 32000) */ maxBudgetTokens?: number; } /** MCP tool definitions for the two context tools. */ export declare const CONTEXT_TOOL_DEFINITIONS: MCPToolDefinition[]; /** * `McpToolProvider` exposing `context_pack` and `blackboard_search`. * Register on a `McpCombinedBridge` alongside the other tool providers. */ export declare class ContextMcpTools { private readonly blackboard; private readonly composer; private readonly ranker; private readonly semantic; private readonly defaultBudgetTokens; private readonly maxBudgetTokens; constructor(options: ContextMcpToolsOptions); /** Returns the MCP tool definitions provided by this module. */ getDefinitions(): MCPToolDefinition[]; /** * Dispatch a tool call by name. All errors are caught and returned as * `{ ok: false, error }`. */ call(toolName: string, args: Record): Promise; private _pack; private _search; private _snapshot; private _requireString; /** Accept number or numeric string; clamp into [min, max]; fall back to a default. */ private _clampNumber; } //# sourceMappingURL=mcp-tools-context.d.ts.map