Shared plumbing for adapters whose target format is plain JSON with no SDK/peer dependency
(OpenAI function-calling, Anthropic tool-use, ...): map each tool to its sanitized name once,
serialize via buildTool, and resolve a tool call back to the original tool definition by that
same sanitized name (the provider echoes the name it was given back in its tool-call response).
Shared plumbing for adapters whose target format is plain JSON with no SDK/peer dependency (OpenAI function-calling, Anthropic tool-use, ...): map each tool to its sanitized name once, serialize via
buildTool, and resolve a tool call back to the original tool definition by that same sanitized name (the provider echoes the name it was given back in its tool-call response).