fix: Anthropic server tools get parameters when forwarded to chat-completions providers
Summary
Fixes #2754.
toChatTools() in packages/backend/src/routing/proxy/anthropic-messages-adapter.ts converts an inbound Anthropic Messages request into Manifest's internal chat-completions shape. For Anthropic server tools (web_search, bash, computer, text_editor, mcp_toolset, etc.) it omitted the parameters field on the converted tool entirely, since these tools have no input_schema in the Anthropic wire format.
That converted body isn't only used for routing/scoring — it's the literal wire payload forwarded to non-Anthropic providers reached through the chat-completions format (ProviderClient.forward's needsChatBody path, used e.g. for MiniMax). Some of those providers reject any function tool whose parameters field is missing outright, so a request containing a server tool 400s before the model even runs — exactly the repro in the issue (MiniMax: invalid params, function parameters is empty (2013)).
Fix
This ships the smaller of the two options the issue proposes: server tools now get the same safe empty-object schema ({ type: 'object', properties: {}, additionalProperties: false }) already used for unrecognized tool types (issue #1897), rather than omitting parameters entirely. The schema content is never meaningful to a provider that can't execute an Anthropic-internal tool anyway — the fix is just making sure the field exists.
Requests actually routed to a real Anthropic provider are unaffected: per the existing comment in the file (and issue #1886's test), the wire body sent there is built by applyAnthropicMessagesMutations directly from the inbound Anthropic body, not from this chat-completions translation.
I deliberately did not also implement the issue's option 2 (dropping server tools entirely for non-Anthropic providers) — at the point toChatTools runs, the target provider hasn't been resolved yet (it runs before provider/model resolution, feeding both the scorer and, for chat-completions-format providers, the forwarded wire body), so doing that safely would need a larger restructuring of where tool translation happens relative to provider resolution. Happy to discuss if maintainers would rather see that approach.
Also removed the now-unused ANTHROPIC_SERVER_TOOL_PREFIXES / ANTHROPIC_SERVER_TOOL_TYPES / isAnthropicServerToolType helpers, since server tools no longer need special-casing in this function.
Test plan
- Updated the existing
anthropic-messages-adapter.spec.tstest (issue #1886) that documented the old parameters-omitted behavior for server tools - Added a new regression test reproducing #2754 directly, asserting
web_search,bash, andmcp_toolsettools all get the safe empty schema -
npx jest routing/proxy— 2287/2287 passing -
npx jest(full backend suite) — 8509/8511 passing; the 2 failures (public-stats.service.spec.ts,notification-cron.service.edge-cases.spec.ts) are pre-existing and reproduce identically on unmodifiedmain— unrelated to this change (timezone/environment-dependent) -
npx eslinton the changed files — clean -
npx tsc --noEmit— clean - Added a changeset (
manifest, patch)
AI assistance disclosure
This PR was prepared with the assistance of Claude Code (Anthropic), including root-cause investigation, the code change, and the regression tests. I reviewed the diff and verified all checks above myself before opening this PR.
Summary by cubic
Fixes #2754: Anthropic server tools no longer get forwarded to non-Anthropic chat-completions providers without a parameters field. toChatTools() previously omitted it for these tools, and strict providers like MiniMax reject any function tool missing parameters with a 400 before the model runs.
- Server tools now get the same safe empty-object schema already used for unrecognized tool types.
- Requests routed to real Anthropic providers are unaffected; their wire body comes from
applyAnthropicMessagesMutationsdirectly. - Removed the now-unused
ANTHROPIC_SERVER_TOOL_PREFIXES,ANTHROPIC_SERVER_TOOL_TYPES, andisAnthropicServerToolTypehelpers. - Added regression tests covering
web_search,bash, andmcp_toolset.