You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Include McpError 'data' payload in JSON-RPC error response #774
Problem:
When a tool throws an McpError with a data payload for structured error context, the server's error handler correctly catches the error but only includes the code and message in the final JSON-RPC response. The data field is ignored and not sent to the client.
This limits the ability to provide rich, machine-readable error context from tools as intended by the JSON-RPC specification.
To Reproduce:
Create a tool that throws an McpError with a data payload:
throw new McpError(
ErrorCode.InvalidParams,
'Invalid parameters provided.',
{
'field': 'experienceId',
'issue': 'The experience ID is not valid.',
}
);
});
Expected Outcome:
{
"jsonrpc": "2.0",
"error": {
"code": -32602,
"message": "Invalid parameters provided.",
"data": {
"field": "experienceId",
"issue": "The experience ID is not valid."
}
},
"id": "1"
}
@felixweinberger shouldn't this rank higher than P3, since it's part of the MCP schema as per here. Also, please consider that structured errors are crucial for building on top of MCP.
@felixweinberger shouldn't this rank higher than P3, since it's part of the MCP schema as per here. Also, please consider that structured errors are crucial for building on top of MCP.
I'm already looking at it, thank you for submitting #1031
Activity
matiasedgeandnode commentedon Oct 16, 2025
This is required by the x402 spec - Please fix.
feat: include data in JSON-RPC error response (modelcontextprotocol#774)
feat: include data in JSON-RPC error response (modelcontextprotocol#774)
felixweinberger commentedon Oct 17, 2025
Already has a PR: #1031
matiasedgeandnode commentedon Oct 17, 2025
@felixweinberger shouldn't this rank higher than
P3, since it's part of the MCP schema as per here. Also, please consider that structured errors are crucial for building on top of MCP.feat: include data in JSON-RPC error response (modelcontextprotocol#774)
feat: include data in JSON-RPC error response (modelcontextprotocol#774)
feat: include data in JSON-RPC error response (modelcontextprotocol#774)
feat: include data in JSON-RPC error response (modelcontextprotocol#774)
felixweinberger commentedon Oct 21, 2025
I'm already looking at it, thank you for submitting #1031
feat(mcp): handle McpError(-32042) for payment challenges
felixweinberger commentedon Mar 26, 2026
Fixed by #1105.
feat(mcp): handle McpError(-32042) for MCP payment challenges (#1728)