-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
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"
}
Actual Outcome:
{
"type": "text",
"text": "MCP error -32602: Invalid parameters provided."
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request