Skip to content

fix(tooling): resolve Gemini API schema validation error #9

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

owenmillera
Copy link

This pull request resolves a schema validation error that occurs when using the Directus MCP server with the Gemini CLI. The create-field tool definition included a width parameter using z.enum, which was not correctly translated into a valid JSON schema, omitting the necessary type property. This caused a 400 INVALID_ARGUMENT error from the Gemini API.

The fix involves two main changes:

  • In src/types/fields.ts, the z.enum for the width property in FieldMetaSchema and FieldSchema has been replaced with optionalString(), and the possible values are now described in the parameter's description.
  • In src/utils/define.ts, explicit return types (ToolDefinition and PromptDefinition) have been added to the defineTool and definePrompt functions to resolve a TypeScript build error that surfaced after the first change.

After applying these changes, the project builds successfully, and the Gemini CLI operates without any API errors.

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.

1 participant