import type { ToolDefinition } from './contract.js'; /** * The low-frequency tools a client may leave out of each request and find by search instead: the drilldowns into a * chart already cast, and the calculations a first reading seldom needs. The chart tools stay offered. */ export declare const DEFERRED_TOOL_NAMES: readonly string[]; /** How many tools a search returns unless asked otherwise, and at most. */ export declare const TOOL_SEARCH_LIMIT = 8; export declare const TOOL_SEARCH_MAX_LIMIT = 20; export declare function isDeferredTool(name: string): boolean; /** Query terms: Latin words of two or more characters, and overlapping CJK bigrams (a lone character stays whole). */ export declare function toolSearchTerms(query: string): string[]; /** A tool a search can find: its name and description, with its title looked up separately. */ export interface ToolSearchCandidate { name: string; description: string; } /** * Names of the best matches, best first; ties keep the candidates' order. A name match outranks a title, a title a * keyword, and all of them outrank the description, so "大运" finds `bazi_dayun` before a tool that merely mentions it. * Pi's own search ranks with BM25 over Latin tokens, where a Chinese query tokenizes to nothing. */ export declare function rankDeferredTools(query: string, candidates: readonly ToolSearchCandidate[], titles: ReadonlyMap, limit?: number): string[]; /** * Which tools an MCP server lists. `all` lists every tool. `core` lists the tools a reading starts from and reaches the * deferred ones through `tool_search` and `tool_call`: MCP has no deferred tools, and a tool list may not change as a * side effect of other requests, so the list itself stays fixed and smaller. */ export type ToolListMode = 'all' | 'core'; export declare function parseToolListMode(value: string | undefined): ToolListMode; export declare const TOOL_SEARCH_NAME = "tool_search"; export declare const TOOL_CALL_NAME = "tool_call"; /** The two tools through which a `core` list reaches the deferred tools. */ export declare function getToolGatewayDefinitions(): ToolDefinition[]; /** The deferred tools among `definitions` that best match the query, best first. */ export declare function searchDeferredTools(query: string, definitions: readonly T[], limit?: number): T[]; /** What a search tells the model: each match with its whole description and input schema, ready for tool_call. */ export declare function renderToolSearchResult(matches: readonly ToolDefinition[]): string; /** Server instructions: where the reading methods are, and in `core` mode how to reach the tools not listed. */ export declare function getServerInstructions(mode: ToolListMode): string; //# sourceMappingURL=tool-search.d.ts.map