fix(server): generate tool output schema in serialization mode
Closed
JA
1mo ago+82+82+01234567890123456789-3-3-0123456789
Fixes #3100.
The tool output schema is generated with model_json_schema(), which defaults to validation mode, but structured content is serialized with model_dump(mode="json", by_alias=True) in FuncMetadata.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 outputSchema sees 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_aliases only covers plain alias=, which agrees in both modes).