Normalizes Claude tool definitions by defaulting missing type discriminators to 'custom' for strict Anthropic-compatible gateway compatibility. Reuse for Claude API tool handling.
// Source: https://github.com/ChrisStack95/omniroute95 | License: MIT | Copyright 2026 diegosouzapw // Provided via justclaw.it.com; keep this notice with the code. // Claude (Anthropic Messages) tool-definition normalization for outbound requests. type UnknownRecord = Record<string, unknown>; /** * Claude's tool schema requires every tool to carry an explicit `type` discriminator * (e.g. "custom", "computer_20241022", "bash_20241022"). Anthropic's own API infers * "custom" when it's omitted, but strict Anthropic-compatible gateways (e.g. MiniMax) * enforce the documented schema and reject payloads whose tools lack `type` with * HTTP 400. Default a missing `type` to "custom" so legacy Claude-format tool * definitions survive strict gateways, while leaving any tool that already decl ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key