-
Couldn't load subscription status.
- Fork 1.4k
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementNew feature or requestNew feature or requestready for workEnough information for someone to start working onEnough information for someone to start working on
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."
}
matiasedgeandnode and KKonstantinov
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featureenhancementNew feature or requestNew feature or requestready for workEnough information for someone to start working onEnough information for someone to start working on