-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Gemini requires parameters of type Array to provide schemas for array elements #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ const SHARED_PROMPTS = { | |
| If you need to include personalization, you can use liquid to include dynamic content in the email and the subject line. | ||
| The following variables are always available to use in liquid: | ||
|
|
||
| - \`recipient.id\`: The ID of the recipient. | ||
| - \`recipient.id\`: The ID of the recipient. | ||
| - \`recipient.name\`: The name of the recipient. | ||
| - \`recipient.email\`: The email of the recipient. | ||
| - \`recipient.phone_number\`: The phone number of the recipient. | ||
|
|
@@ -62,8 +62,8 @@ const SHARED_PROMPTS = { | |
| <example> | ||
| # Hello, {{ recipient.name }} | ||
|
|
||
| This is a dynamic message: | ||
| This is a dynamic message: | ||
|
|
||
| > {{ data.message }} | ||
| </example> | ||
|
|
||
|
|
@@ -77,6 +77,20 @@ const SHARED_PROMPTS = { | |
| `, | ||
| }; | ||
|
|
||
| const contentTypes = z.enum([ | ||
| "markdown", | ||
| "html", | ||
| "image", | ||
| "button_set", | ||
| "divider", | ||
| "partial", | ||
| ]); | ||
|
|
||
| // TODO: Add full schema for all block types, but we need to do that without expressing it as a union type. | ||
| const contentBlockSchema = z.object({ | ||
| type: contentTypes, | ||
| }); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a comprehensive schema for content blocks, but it demonstrates that the mcp server starts working once some schema is provided. |
||
|
|
||
| const createEmailStepInWorkflow = KnockTool({ | ||
| method: "create_email_step_in_workflow", | ||
| name: "Create email step in workflow", | ||
|
|
@@ -87,7 +101,7 @@ const createEmailStepInWorkflow = KnockTool({ | |
|
|
||
| ## Blocks | ||
|
|
||
| The content of the email is supplied as an array of "blocks". The simplest block is a "markdown" block, which supports content in a markdown format. That should always be your default block type. | ||
| The content of the email is supplied as an array of "blocks". The simplest block is a "markdown" block, which supports content in a markdown format. That should always be your default block type. | ||
|
|
||
| The following block types are supported: | ||
|
|
||
|
|
@@ -133,7 +147,7 @@ const createEmailStepInWorkflow = KnockTool({ | |
| } | ||
| </example> | ||
|
|
||
| ### HTML | ||
| ### HTML | ||
|
|
||
| The \`html\` block supports raw HTML content. This should be used sparingly, and only when you need to include custom HTML content that markdown doesn't support. When using the \`html\` block, you must supply a \`content\` key. HTML content can include liquid personalization. | ||
|
|
||
|
|
@@ -184,7 +198,7 @@ const createEmailStepInWorkflow = KnockTool({ | |
| .string() | ||
| .describe("(string): The key of the workflow to add the step to."), | ||
| blocks: z | ||
| .array(z.any()) | ||
| .array(contentBlockSchema) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the key fix |
||
| .describe("(array): The blocks for the email step."), | ||
| subject: z.string().describe("(string): The subject of the email step."), | ||
| }), | ||
|
|
@@ -227,8 +241,8 @@ const createSmsStepInWorkflow = KnockTool({ | |
| method: "create_sms_step_in_workflow", | ||
| name: "Create sms step in workflow", | ||
| description: ` | ||
| Creates an SMS step in a workflow. Use this tool when you're asked to create an SMS notification and you need to specify the content of the SMS. | ||
| Creates an SMS step in a workflow. Use this tool when you're asked to create an SMS notification and you need to specify the content of the SMS. | ||
|
|
||
| ${SHARED_PROMPTS.workflow} | ||
|
|
||
| ${SHARED_PROMPTS.liquid} | ||
|
|
@@ -328,7 +342,7 @@ const createInAppFeedStepInWorkflow = KnockTool({ | |
| method: "create_in_app_feed_step_in_workflow", | ||
| name: "Create in app feed step in workflow", | ||
| description: ` | ||
| Creates an in app feed step in a workflow. Use this tool when you're asked to create an in app feed notification and you need to specify the content of the in app feed notification. | ||
| Creates an in app feed step in a workflow. Use this tool when you're asked to create an in app feed notification and you need to specify the content of the in app feed notification. | ||
|
|
||
| ${SHARED_PROMPTS.workflow} | ||
|
|
||
|
|
@@ -435,7 +449,7 @@ const createDelayStepInWorkflow = KnockTool({ | |
| Creates a delay step in a workflow. Use this tool when you're asked to add a delay to the workflow that pauses, or waits for a period of time before continuing. | ||
|
|
||
| ${SHARED_PROMPTS.workflow} | ||
|
|
||
| Delays are specified in "unit" and "value" pairs. The only valid units are "seconds", "minutes", "hours", and "days". | ||
|
|
||
| <example> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, my editor deleted a bunch of whitespace