-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed as not planned
Closed as not planned
Copy link
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Milestone
Description
Describe the bug
Overview
Resource template values containing path separators (slashes) do not work.
Working Examples
Simple Static Resources
@mcp.resource("resource://my-resource")
def get_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}")
def get_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:.*}")
def get_content(value: str) -> dict[str, Any]:
# Error: Mismatch between URI parameters set() and function parameters {'permalink'}2. Generic Catch-all Pattern
@mcp.resource("memory://*")
def get_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}")
def get_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")
def get_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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers