Skip to content

Add support for data to McpProtocolException #1025

@glen-84

Description

@glen-84

Is your feature request related to a problem? Please describe.

The McpProtocolException class doesn't support data. I'm trying to add the uri to the Resource not found error, as shown here.

Describe the solution you'd like

Add another exception parameter, or pass along Exception.Data.

Describe alternatives you've considered

I tried using Exception.Data, but it's not persisted.

throw new McpProtocolException(
    ReadResourceHandler_ResourceNotFound,
    (McpErrorCode)(-32002))
{
    Data =
    {
        { "uri", context.Params!.Uri }
    }
};

Additional context

See also #863.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions