Skip to content

fix: use z.string() for attachment content to fix Gemini compatibility#14

Open
MaxwellCalkin wants to merge 1 commit intoagentmail-to:mainfrom
MaxwellCalkin:fix/gemini-base64-schema-compat
Open

fix: use z.string() for attachment content to fix Gemini compatibility#14
MaxwellCalkin wants to merge 1 commit intoagentmail-to:mainfrom
MaxwellCalkin:fix/gemini-base64-schema-compat

Conversation

@MaxwellCalkin
Copy link

@MaxwellCalkin MaxwellCalkin commented Mar 7, 2026

Summary

  • Replaces z.base64() with z.string() for the attachment content field in the schema
  • z.base64() produces a contentEncoding: "base64" field in the JSON Schema output, which Google Gemini's function calling API does not support
  • This caused tool registration to fail for send_message, reply_to_message, and forward_message tools when used with any Gemini model

The description 'Base64 encoded content' is preserved so consumers still know to provide base64 data.

Fixes agentmail-to/agentmail-mcp#8

Test plan

  • Verify MCP tools register successfully with Gemini models
  • Verify attachment content still works with base64 strings via Claude/OpenAI

🤖 Generated with Claude Code


Summary by cubic

Switch the attachment content field from z.base64() to z.string() to avoid emitting contentEncoding in the JSON Schema, which Gemini’s function-calling API does not support. This unblocks MCP tool registration (send_message, reply_to_message, forward_message) with Gemini, while keeping the "Base64 encoded content" description so clients still send base64 strings.

Written for commit 342d8dc. Summary will update on new commits.

z.base64() produces a contentEncoding field in the JSON Schema output
which Google Gemini's function calling API does not support, causing
tool registration to fail for send_message, reply_to_message, and
forward_message tools.

Fixes agentmail-to/agentmail-mcp#8

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

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.

Gemini function calling rejects tool schemas due to "contentEncoding" field

1 participant