/** * Tool-call name normalization for malformed LLM tool_use outputs. * * LLMs — especially smaller / faster models — frequently emit tool_use * blocks with names that don't exactly match the registered tool name: * * - Wrong delimiter: `outlook/operations` vs `outlook_operations` * - Function-prefix style: `functions.outlook_operations` * - Case drift: `Outlook_Operations` * - Counter suffix: `outlook_operations_1` * - Missing name, only id: `{name: "", id: "tool_outlook_operations_42"}` * * Before this normalization layer, any of the above caused the LangGraph * ToolNode to throw "Tool X not found" and the whole turn to fail. With * normalization, we resolve to the correct registered name case-insensitively * and transparently fix the tool_call in place. * * Resolution order: * 1. Exact match * 2. Normalized delimiter + exact * 3. Case-insensitive match * 4. Structured candidates (strip prefixes, take suffix segments) * 5. Infer from tool_call id (strip trailing digits, function/tool prefix) * * Any unresolvable tool_call is left as-is — the downstream ToolNode will * fail with its usual error and the auto-recovery path kicks in. */ /** * Produce the best allowed tool name for a raw LLM tool_use name. * Returns the original name unchanged if no resolution is possible — * the downstream executor will then fail with its normal error path. */ export declare function normalizeToolCallName(rawName: string, allowedToolNames: Set, rawToolCallId?: string): string; /** * In-place normalization of all tool_calls on an AIMessage-like object. * * Applies `normalizeToolCallName` to each tool_call's `name` field using the * provided allowed-tool set (derived from the agent's toolMap keys). Also * rewrites the `name` field inside any content blocks of type `tool_use` so * that downstream providers see the corrected name. * * Returns `true` if any name was rewritten. */ export declare function normalizeMessageToolCalls(message: unknown, allowedToolNames: Set): boolean;