Skip to content

Conversation

@cpsievert
Copy link
Collaborator

Summary

  • Fixed MCP tools not working with ChatGoogle() by using tool.schema directly instead of FunctionDeclaration.from_callable()
  • Added _strip_additional_properties() helper to remove additionalProperties from schemas (Google's API rejects this field)
  • Updated VCR cassettes for tool tests

Root Cause

The Google provider was using FunctionDeclaration.from_callable() which introspected the wrapper function for MCP tools instead of using the pre-computed schema. This resulted in:

  • Wrong function name (_call instead of the actual tool name like fetch)
  • Empty/minimal description
  • No parameters (because **args has no type hints)

Test plan

  • All existing tests pass (make check)
  • Tool tests pass with live API (--disable-recording)
  • VCR cassettes updated and verified

Fixes #257

🤖 Generated with Claude Code

The Google provider was using FunctionDeclaration.from_callable() which
introspected the wrapper function for MCP tools instead of using the
pre-computed schema. This resulted in:
- Wrong function name (_call instead of the actual tool name)
- Empty/minimal description
- No parameters (because **args has no type hints)

Changed to use tool.schema["function"] directly to construct
FunctionDeclaration with the correct name, description, and parameters.
Added _strip_additional_properties() helper to remove additionalProperties
from schemas since Google's API rejects this field.

Fixes #257

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ChatGoogle: MCP tools don't work due to schema generation from wrapper function

2 participants