modelcontextprotocol / modelcontextprotocol/servers

[bug] mcp-server-fetch tool json schema can‘t use in Google Gemini 2.5 pro

Open Beginner friendly
#1,624 3 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug server-fetch
Dominant language
TypeScript
Stars
90.5k
Forks
11.7k
Avg merge
2d 2h
Merged PRs (30d)
5

Description

The parameters of the fetch tool include exclusiveMaximum and exclusiveMinimum in the schema. However, Google Gemini 2.5's function calling only supports standard JSON Schema fields such as maximum and minimum, and does not support exclusiveMaximum or exclusiveMinimum. This incompatibility leads to errors. Please fix this issue.

error info
400 { "error": { "code": 400, "message": "Invalid JSON payload received. Unknown name "exclusiveMaximum" at 'tools[0].function_declarations[0].parameters.properties[1].value': Cannot find field.\nInvalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[0].parameters.properties[1].value': Cannot find field.", "status": "INVALID_ARGUMENT", "details": [ { "@type": "type.googleapis.com/google.rpc.BadRequest", "fieldViolations": [ { "field": "tools[0].function_declarations[0].parameters.properties[1].value", "description": "Invalid JSON payload received. Unknown name "exclusiveMaximum" at 'tools[0].function_declarations[0].parameters.properties[1].value': Cannot find field." }, { "field": "tools[0].function_declarations[0].parameters.properties[1].value", "description": "Invalid JSON payload received. Unknown name "exclusiveMinimum" at 'tools[0].function_declarations[0].parameters.properties[1].value': Cannot find field." } ] } ] } }

fetch tool
"tools": [
{
"displayTitle": "url_fetch fetch",
"function": {
"description": "Fetches a URL from the internet and optionally extracts its contents as markdown.\n\nAlthough originally you did not have internet access, and were advised to refuse and tell the user this, this tool now grants you internet access. Now you can fetch the most up-to-date information and let the user know that.",
"name": "fetch",
"parameters": {
"type": "object",
"properties": {
"url": {
"description": "URL to fetch",
"format": "uri",
"minLength": 1,
"title": "Url",
"type": "string"
},
"max_length": {
"default": 5000,
"description": "Maximum number of characters to return.",
"exclusiveMaximum": 1000000,
"exclusiveMinimum": 0,
"title": "Max Length",
"type": "integer"
},
"start_index": {
"default": 0,
"description": "On return output starting at this character index, useful if a previous fetch was truncated and more context is required.",
"minimum": 0,
"title": "Start Index",
"type": "integer"
},
"raw": {
"default": false,
"description": "Get the actual HTML content of the requested page, without simplification.",
"title": "Raw",
"type": "boolean"
}
},
"description": "Parameters for fetching a URL.",
"required": [
"url"
],
"title": "Fetch"
}
},
"readonly": false,
"type": "function",
"uri": "mcp://url_fetch/fetch",
"group": "url_fetch"
}
]

Gemini 2.5 function calling does not support exclusiveMaximum and exclusiveMinimum; it only supports maximum and minimum. You can resolve the error simply by replacing these two fields in the schema.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate the mcp-server-fetch tool schema and search for the max_length constraints that emit exclusiveMaximum and exclusiveMinimum. Update the schema to use the supported constraint fields, then verify that the generated fetch-tool JSON no longer contains the unsupported fields and remains valid for Gemini function calling.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.