Skip to content

fix(server): name the unsupported anthropic tool type in the 400 instead of a missing input_schema - #959

Merged
jason-fxz merged 1 commit into
mainfrom
fix/anthropic-server-tool-400
Nov 27, 2026
Merged

jason-fxz merged 1 commit into
mainfrom
fix/anthropic-server-tool-400

Conversation

@jason-fxz

Copy link
Copy Markdown
Collaborator

Claude Code's WebSearch sends an Anthropic-defined tool, {"type": "web_search_20250305", "name": "web_search", "max_uses": 8}, with no input_schema. /v1/messages answered with a 400 saying tools.0.input_schema: Field required, which points the client at its schema instead of at the tool type this server does not support.

Changes

  • AnthropicTool: a mode="before" model validator rejects a tool that has no input_schema and a type other than custom, with tool type '<type>' is not supported; only custom tools with an input_schema are. This covers the Anthropic-defined tools (web_search_*, bash_*, text_editor_*, ...). Custom tools, with or without type: "custom", are validated as before.

The request is still a 400 in the Anthropic error envelope; only the message changes.

vLLM rejects these tools the same way (reject_anthropic_defined_tools in its Anthropic protocol). SGLang drops them from the tool list with an info log and serves the request.

Tests

  • tests/server/test_anthropic_api.py::test_validation_error_uses_anthropic_envelope: a web_search_20250305 tool gets a 400 that names the type.
  • pytest tests/server: 689 passed.

@jason-fxz
jason-fxz merged commit 907e001 into main Nov 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant