fastmcp/tests/client/sampling/handlers
Bill Easton 671eaf0f03
fix: strip title fields from tool schemas for Gemini 2.5 Flash compatibility (#3861)
* fix: strip title fields from tool schemas for Gemini compatibility

Gemini 2.5 Flash produces MALFORMED_FUNCTION_CALL when a function
declaration's parameters_json_schema contains 'title' fields (which
Pydantic adds by default). Strip them in _convert_tool_to_google_genai
before passing to the API.

Fixes #3860

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix ty errors and lowest-deps test failure

- Add assertions for non-None before subscripting FunctionDeclaration
  fields (ty check)
- Test compress_schema directly instead of constructing FunctionDeclaration
  which may not support parameters_json_schema in google-genai==1.18.0

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 12:51:49 -04:00
..
__init__.py Unify SamplingHandler and promote OpenAI handler (#2616) 2025-12-14 15:22:43 -05:00
test_anthropic_handler.py Support ImageContent and AudioContent in sampling handlers (#3550) 2026-03-18 15:25:16 -04:00
test_google_genai_handler.py fix: strip title fields from tool schemas for Gemini 2.5 Flash compatibility (#3861) 2026-04-12 12:51:49 -04:00
test_openai_handler.py Update ty ignore comments for 0.0.25 compatibility (#3614) 2026-03-24 20:26:26 -04:00