@unified-llm/core
Version:
Unified LLM interface (in-memory).
35 lines • 1.38 kB
TypeScript
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import type { Logger } from "../../types/index.js";
import { Clock } from "../timing.js";
export declare const NOOP_LOGGER: Logger;
/**
* プロバイダー間で共通に扱える tool call の中立形
*/
export type NormalizedToolCall = {
name: string;
callId: string;
arguments?: string | Record<string, unknown>;
};
/**
* tool result の中立形(実行エンジンの返り値)
*/
export type NormalizedToolResult = {
name: string;
callId: string;
output: string;
};
export type LocalToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
export type ExecuteToolCallsOptions = {
logger?: Logger;
clock?: Clock;
};
/**
* tool call を実行して結果を文字列として返す(プロバイダー非依存)。
*
* - localToolHandlers が該当すれば優先
* - それ以外は MCP に委譲
* - 例外は握りつぶして `{ ok:false, error }` を output に詰める(LLMループを止めない)
* - sanitizeToolCallResult を適用して安全化
*/
export declare function executeToolCalls(toolCalls: NormalizedToolCall[], toolNameToClient: Map<string, Client>, localToolHandlers?: Map<string, LocalToolHandler>, options?: ExecuteToolCallsOptions): Promise<NormalizedToolResult[]>;
//# sourceMappingURL=execute-tool-calls.d.ts.map