Repository navigation
fix(server): generate tool output schema in serialization mode - #3118
jayzuccarelli wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 2 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
Checking in on this one — all green on my side. Let me know if anything's blocking. |
|
Checking back on this one. Still mergeable, 30 checks green, and cubic's review points are all addressed. It's independent of #3119: different failure mode, no overlap in the diff, so it can land on its own if that's simpler. Say the word and I'll rebase onto current main. |
Computed fields and serialization aliases are part of the dumped structured content, so the published output schema must be generated in serialization mode or clients see keys the schema never advertised. A directly-returned CallToolResult is normalized the same way. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013imUsuHJy6xYdvZdxgmqtF
6cf1dd6 to
c7c303f
Compare
|
Thanks for the PR, and sorry it sat here without a proper review. We're closing most of the open PR backlog. v2 is out and changed a lot of the SDK, so many older PRs no longer apply as written, and we're a small team that realistically doesn't have the capacity to work through the rest. If this still matters to you on v2, the most useful thing you can do is open an issue (or comment on the existing one) with your use case and a repro. Hearing why it matters to you is what we use to decide what to prioritise. |
Fixes #3100.
The tool output schema is generated with
model_json_schema(), which defaults to validation mode, but structured content is serialized withmodel_dump(mode="json", by_alias=True)inFuncMetadata.convert_result. The two disagree for:@computed_fields — present in the serialized payload, absent from the schema.serialization_alias— the dumped key uses the serialization alias, but the schema advertises the validation name.So a client validating structured content against the published
outputSchemasees unexpected or misnamed properties.Generate the output schema in serialization mode so it matches what the server actually sends. Added regression tests for the computed-field and serialization-alias cases (the existing
test_structured_output_aliasesonly covers plainalias=, which agrees in both modes).