import type { AgentTool } from "@kenkaiiii/gg-agent"; import { type ContextLimits } from "../context-limits.js"; /** Clamp a tool's description to the MCP description budget (eager or deferred). */ export declare function clampMcpToolDescription(tool: AgentTool, limits?: ContextLimits): AgentTool; /** * Holds MCP tools OUT of the per-turn request payload until the model asks * for them via `tool_search`. * * Measured: injecting every MCP tool schema * eagerly cost ~33KB (~8.3k tokens) per cache-miss turn with just two MCP * servers connected — 56% of all billed input tokens in a 6-turn session. * Deferring keeps the tool prefix small and byte-stable; promotion is a * one-time cache break paid only when a capability is actually needed. * * Descriptions are clamped at `add` time (server-controlled content): a * hostile or bloated MCP server must not be able to inflate every * tool_search result — and, once promoted, every request's tool schema. */ export declare class DeferredToolCatalog { private readonly limits; private byName; constructor(limits?: ContextLimits); add(tools: AgentTool[]): void; /** Remove tools (e.g. when their MCP server is reloaded/removed). */ removeWhere(predicate: (name: string) => boolean): void; get size(): number; /** Names still waiting in the catalog (for "no match" tool output). */ names(): string[]; /** * Rank catalog tools against a free-text capability query. * Word-overlap scoring: name hits weigh 3×, description hits 1×. */ search(query: string, limit?: number): AgentTool[]; /** Remove the named tools from the catalog and return them for activation. */ promote(names: string[]): AgentTool[]; } //# sourceMappingURL=deferred-catalog.d.ts.map