From 8dbea9ecd13a507380709a1f91e26079d72fa73c Mon Sep 17 00:00:00 2001 From: Ravi Tharuma Date: Sun, 1 Mar 2026 10:40:35 +0100 Subject: [PATCH] fix: use z.string() instead of z.base64() for attachment content z.base64() generates `contentEncoding: "base64"` in the JSON Schema output (via zod-to-json-schema). Google Gemini's function calling API does not support `contentEncoding` in its schema subset, causing 400 errors when registering tools that use this field. Replacing with z.string() preserves the same runtime behavior (base64 strings are valid strings) while producing a Gemini-compatible schema. The description already indicates the expected format is base64. Fixes agentmail-to/agentmail-mcp#8 --- node/src/schemas.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/src/schemas.ts b/node/src/schemas.ts index 075499a..2326f54 100644 --- a/node/src/schemas.ts +++ b/node/src/schemas.ts @@ -41,7 +41,7 @@ export const GetAttachmentParams = z.object({ const AttachmentSchema = z.object({ filename: z.string().optional().describe('Filename'), content_id: z.string().optional().describe('Content ID for inline attachments'), - content: z.base64().optional().describe('Base64 encoded content'), + content: z.string().optional().describe('Base64 encoded content'), url: z.url().optional().describe('URL'), })