Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Response ID-value not matching request value, due to default int #961

Open
@sProdz

Description

@sProdz

Initial Checks

Description

When the client sends a request with id field value of type string, the server MUST respond with exactly the same value. When the #851 was accepted to version 1.9.4 it broke this standard causing errors for example in Microsoft Copilot Studio, because of the mismatch in the response id value.

"id
This member is REQUIRED.
It MUST be the same as the value of the id member in the Request Object.
If there was an error in detecting the id in the Request object (e.g. Parse error/Invalid Request), it MUST be Null.
" JSON-RPC 2.0 spec.

Example Code

curl -N \
  -X POST http://localhost:8000/mcp/ \                    
  -H "Accept: application/json, text/event-stream" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":"1","method":"tools/list","params":{}}' # String

Response:

{
    "jsonrpc": "2.0",
    "id": 1,  # Int
    "result": {
        "tools": [
            {
                "name": "query",
                "description": "Ask an LLM agent to answer the query using internal documents",
                "inputSchema": {
                    "properties": {
                        "query": {
                            "title": "Query",
                            "type": "string"
                        }
                    },
                    "required": [
                        "query"
                    ],
                    "title": "query_toolArguments",
                    "type": "object"
                },
                "annotations": {
                    "title": "Internal Docs Query",
                    "readOnlyHint": true,
                    "destructiveHint": false,
                    "idempotentHint": true,
                    "openWorldHint": false
                }
            }
        ]
    }
}

Python & MCP Python SDK

Python 3.11
MCP Python SDK 1.9.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions