Skip to content

Strict JSON schema validation rule in MCP tools #6632

@blouflab

Description

@blouflab

What happened?

MCP servers with tools where the JSON schema doesn't specify a type are skipped during gemini loading, even though it works perfectly.

What did you expect to happen?

n8n deploys similar tools, and it's not a problem for others cli

Client information

╭────────────────────────────────────────────────────────────────────────────────╮
│ │
│ About Gemini CLI │
│ │
│ CLI Version 0.1.22 │
│ Git Commit 5fe4e02
│ Model gemini-2.5-pro │
│ Sandbox no sandbox │
│ OS linux │
│ Auth Method OAuth │
│ │
╰────────────────────────────────────────────────────────────────────────────────╯

Login information

No response

Anything else we need to know?

IN packages/core/src/tools/mcp-client.ts, line 570, function hasValidTypes
+++++++
THIS CHECK COULD BE COMMENTED ?
if (!s['type']) {
// These keywords contain an array of schemas that should be validated.
//
// If no top level type was given, then they must each have a type.
let hasSubSchema = false;
const schemaArrayKeywords = ['anyOf', 'allOf', 'oneOf'];
for (const keyword of schemaArrayKeywords) {
const subSchemas = s[keyword];
if (Array.isArray(subSchemas)) {
hasSubSchema = true;
for (const subSchema of subSchemas) {
if (!hasValidTypes(subSchema)) {
return false;
}
}
}
}
// If the node itself is missing a type and had no subschemas, then it isn't valid.
if (!hasSubSchema) return false;
}
+++++++

I tried it on a local fork, and it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionalitypriority/p2Important but can be addressed in a future release.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions