-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on
Description
Description
When using ResourceTemplate with optional parameters (e.g., {param?}), if a user selects <Empty> from the completion dropdown, the resulting URI doesn't match the template pattern, causing the resource to fail to load.
The resource kubernetes://resources/nodes/ was not found.
Steps to Reproduce
- Create a ResourceTemplate with an optional parameter:
"scheme://path/{required}/{optional?}" - User selects a value for
requiredparameter - User selects
<Empty>for theoptionalparameter from the completion dropdown - The resulting URI becomes something like
scheme://path/required/<Empty> - This URI doesn't match the original template pattern and fails validation
Expected Behavior
When a user selects <Empty> for an optional parameter, the URI should either:
- Omit that path segment entirely (e.g.,
scheme://path/required) - Map
<Empty>to an empty string and handle it gracefully in the URI parsing
Current Workaround
We have to manually handle both cases in our readCallback:
scheme://path/required(when optional param is truly omitted)scheme://path/required/<Empty>(when user explicitly selects<Empty>)
Impact
This makes ResourceTemplates with optional parameters brittle and requires additional error-prone parsing logic in every implementation.
Environment
- MCP TypeScript SDK version: latest
- Context: ResourceTemplate with pattern like
kubernetes://resources/{resourceType}/{namespace?}
david-zamora-minderest
Metadata
Metadata
Assignees
Labels
P2Moderate issues affecting some users, edge cases, potentially valuable featureModerate issues affecting some users, edge cases, potentially valuable featurebugSomething isn't workingSomething isn't workingready for workEnough information for someone to start working onEnough information for someone to start working on