Skip to content

feat(tools): Preserve Field descriptions in set_model_response schema - #6715

Open
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/preserve-set-model-response-field-descriptions
Open

feat(tools): Preserve Field descriptions in set_model_response schema#6715
a2105z wants to merge 1 commit into
google:mainfrom
a2105z:feat/preserve-set-model-response-field-descriptions

Conversation

@a2105z

@a2105z a2105z commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When output_schema uses Pydantic Field(description=...), those descriptions were lost in the generated set_model_response tool schema because declaration build goes through inspect.Parameter (no description channel).
  • SetModelResponseTool._get_declaration now re-applies field descriptions from the original output schema onto the tool parameters.
  • Adds unit coverage for BaseModel field descriptions (and list[BaseModel] $defs path).

Fixes #6707

Test plan

  • Repro: Field(description=...) now appears in parameters_json_schema.properties.*.description
  • pytest tests/unittests/tools/test_set_model_response_tool.py — 33 passed
  • Pre-commit on touched files

Made with Cursor

build_function_declaration rebuilds parameters from inspect.Parameter, which
cannot carry Pydantic Field(description=...) metadata, so semantic hints in
output_schema were dropped before reaching the model. Re-apply those
descriptions onto the generated tool declaration.

Fixes google#6707
@a2105z

a2105z commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

Hi @sanketpatil06 @GWeale @DeanChensj — ready for review.

This lands #6707: set_model_response now keeps Field(description=...) from output_schema so the model still sees those semantic hints.

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

Labels

tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Preserve field descriptions in set_model_response tool schema

3 participants