fix: Gemini requires parameters of type Array to provide schemas for array elements#24
fix: Gemini requires parameters of type Array to provide schemas for array elements#24
Conversation
|
| The following variables are always available to use in liquid: | ||
|
|
||
| - \`recipient.id\`: The ID of the recipient. | ||
| - \`recipient.id\`: The ID of the recipient. |
There was a problem hiding this comment.
sorry, my editor deleted a bunch of whitespace
| .describe("(string): The key of the workflow to add the step to."), | ||
| blocks: z | ||
| .array(z.any()) | ||
| .array(contentBlockSchema) |
There was a problem hiding this comment.
this is the key fix .array(z.any()) does not work
|
|
||
| const contentBlockSchema = z.object({ | ||
| type: contentTypes, | ||
| }); |
There was a problem hiding this comment.
This is not a comprehensive schema for content blocks, but it demonstrates that the mcp server starts working once some schema is provided.
src/lib/tools/workflow-steps.ts
Outdated
| type: contentTypes, | ||
| }); | ||
|
|
||
| // const contentBlockSchema = z.union([ |
There was a problem hiding this comment.
I attempted to create a schema for content blocks, but I couldn't get one to work. I suspect that zod is emitting an openapi schema that isn't compatible with gemini for this union type (or I have some other bug here).
Specifically, items.anyOf looks sus. Googles docs show that the items field should contain Schema types, and while anyOf is a field on Schema, I don't think its valid for it to be the only field present. There's probably a clever re-expression of this schema that would be compatible with google's Schema but I ran out of time to figure it out.

We saw an error in cursor that referenced the
create_sms_step_in_workflowtool.And I saw this error in Zed:
If you combine the zed error message with the cursor error message you see that there's a problem with the
blocksparameter of thecreate_sms_step_in_workflowtool.After a bit of digging I found that Gemini has a history of being quite picky with the subset of OpenAPI that it supports.
Loom showing the mcp error failing against a locally version of the MCP server, then succeeding when I checkout and build this branch.
References