Describe the bug
Overview
Resource template values containing path separators (slashes) do not work.
Working Examples
Simple Static Resources
@mcp.resource("resource://my-resource")defget_data() ->dict[str, Any]:
return {
"contents": [{
"uri": "resource://my-resource",
"mimeType": "text/plain",
"text": "Hello, world!"
}]
}This works reliably and shows up in the Inspector UI.
Parameter
@mcp.resource("resource://{value}")defget_content(value: str) ->dict[str, Any]:
# This works for: resource://# But fails for: resourse://value/with/slashes
...To Reproduce
1. Template Pattern with Regex
@mcp.resource("resource://{value:.*}")defget_content(value: str) ->dict[str, Any]:
# Error: Mismatch between URI parameters set() and function parameters {'permalink'}2. Generic Catch-all Pattern
@mcp.resource("memory://*")defget_content(uri: str) ->dict[str, Any]:
# Error: Mismatch between URI parameters set() and function parameters {'uri'}3. Path Parameter Approach
@mcp.resource("resource://content/{path}")defget_content(path: str) ->dict[str, Any]:
# Works for simple paths but fails with slashes in {path}4. Base Path with Query Parameters
@mcp.resource("resource://content")defget_content(path: str=None) ->dict[str, Any]:
# Error: Mismatch between URI parameters set() and function parameters {'path'}Expected behavior
Resource Templates with slashes in the value should be passed to the decorated function.
Describe the bug
Overview
Resource template values containing path separators (slashes) do not work.
Working Examples
Simple Static Resources
This works reliably and shows up in the Inspector UI.
Parameter
To Reproduce
1. Template Pattern with Regex
2. Generic Catch-all Pattern
3. Path Parameter Approach
4. Base Path with Query Parameters
Expected behavior
Resource Templates with slashes in the value should be passed to the decorated function.