Skip to content

Conversation

@adrianlzt
Copy link

Resolves this error returned by the OpenAI API:
{'error': {'message': "Invalid schema for function 'google-suite__query_gmail_emails': False is not of type 'array'.", 'type': 'invalid_request_error', 'param': 'tools[5].function.parameters', 'code': 'invalid_function_parameters'}

Resolves this error returned by the OpenAI API:
{'error': {'message': \"Invalid schema for function 'google-suite__query_gmail_emails': False is not of type 'array'.\", 'type': 'invalid_request_error', 'param': 'tools[5].function.parameters', 'code': 'invalid_function_parameters'}
@MarkusPfundstein
Copy link
Owner

mh interesting. how does this affect Anthropic?

@adrianlzt
Copy link
Author

With anthropic:

400 Bad Request. Message: tools.11.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12 (https://json-schema.org/draft/2020-12). Learn more about tool use at https://docs.anthropic.com/en/docs/tool-use

I am using goose as my MCP client.

@skorfmann
Copy link

I can confirm this issue affects Claude Code (Claude's official CLI) as well. When trying to use the mcp-gsuite server via Claude Code's stdio integration, I get the same schema validation error:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"tools.15.custom.input_schema: JSON schema is invalid. It must match JSON Schema draft 2020-12 (https://json-schema.org/draft/2020-12). Learn more about tool use at https://docs.anthropic.com/en/docs/tool-use."}}

After investigating, I found additional schema validation issues beyond the "required": false fix in this PR:

  1. This PR's fix is correct - the "required": false inside property definitions is invalid JSON Schema syntax
  2. Additional issue: The schemas also contain "default" values throughout the codebase (in both tools_gmail.py and tools_calendar.py), which can cause validation issues with Claude's stricter JSON Schema draft 2020-12 requirements

While this PR fixes the immediate issue with the query tool, you might want to consider removing all "default" values from the input schemas and moving that information to the description field instead. For example:

  • Change: "default": 100
  • To: "description": "Maximum number of emails to retrieve (1-500). Defaults to 100 if not specified."

This would ensure full compatibility with Claude and other APIs that strictly validate against JSON Schema draft 2020-12.

Thanks for the fix! The removal of "required": false is definitely needed and will help many users.

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.

3 participants