Skip to content

fix: carry Anthropic tool input schemas as-is - #2472

Open
CodePrometheus wants to merge 1 commit into
envoyproxy:mainfrom
CodePrometheus:fix/anthropic-tool-schema-properties
Open

fix: carry Anthropic tool input schemas as-is#2472
CodePrometheus wants to merge 1 commit into
envoyproxy:mainfrom
CodePrometheus:fix/anthropic-tool-schema-properties

Conversation

@CodePrometheus

@CodePrometheus CodePrometheus commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Description

An Anthropic tool declares its input as a JSON schema, but the gateway modeled that schema as a struct with only "type", "properties" and "required".
Everything else a client sends is silently dropped on the way to the backend: "additionalProperties", which backends need to enable strict schema adherence, the per-property "description" the model relies on to call the tool correctly, "$defs", and so on.
We hit this with a tool that takes no arguments: its empty "properties" was dropped too, and the OpenAI-compatible backend rejected the whole request with 400 invalid_function_parameters, "object schema missing properties".

The schema is now carried as raw JSON, so tools reach the backend as the client declared them. This covers both the Anthropic-to-OpenAI and the Anthropic-to-Bedrock conversions, which shared the struct.

Related Issues/PRs (if applicable)

Special notes for reviewers (if applicable)

Signed-off-by: Zixin Zhou <zhouzixin@apache.org>
@CodePrometheus
CodePrometheus requested a review from a team as a code owner August 2, 2026 10:48
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 2, 2026
@dosubot

dosubot Bot commented Aug 2, 2026

Copy link
Copy Markdown

📄 Knowledge review

Dosu skipped reviewing this PR because your organization has used its 200 included credits for the month. Your usage will reset on 2026-09-01. To have Dosu review this PR before then, ask your organization admin to upgrade to a pro account.


Leave Feedback Ask Dosu about ai-gateway Add Dosu to your team

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.05%. Comparing base (3fc0f4f) to head (18f8662).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2472   +/-   ##
=======================================
  Coverage   85.05%   85.05%           
=======================================
  Files         159      159           
  Lines       22649    22649           
=======================================
  Hits        19265    19265           
  Misses       2217     2217           
  Partials     1167     1167           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants