| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I can't get any resource params to show up in my MCP Inspector, not sure if its related to the above. This works fine. @mcp.resource("config://app")
def get_config() -> str:
"""Static configuration data"""
return "App configuration here"Once I add an input param it does not show up as a listed resource @mcp.resource("users://{hello}/message")
def get_config(hello: str) -> str:
"""dynamic user message"""
return "Message here {hello}" |
Sorry, something went wrong.
Thank you for working on this and the detailed description. After more time thinking about this, I think the current behaviour is desired. If we want to support paths we should go down the route of FastAPI which offers {var:path} convertor. I'll close this PR, and sorry for you spending the time without it being merged. I think the detailed description made it clear how to best think about this for me. Thank you |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR enhances resource templates so that they can handle values containing slashes.
Motivation and Context
Motivation
This PR fixes the bug reported in #159 where the following example raises an error for paths containing slashes such as resource://content/path/with/slashes.
Currently, this raises mcp.shared.exceptions.McpError: Unknown resource: resource://content/path/with/slashes.
Screenshot from MCP inspector:

Analysis
The root cause is in ResourceTemplate.matches() which explicitly excludes slashes from the regex matching:
python-sdk/src/mcp/server/fastmcp/resources/templates.py
Line 58 in f10665d
Content of Fix
How Has This Been Tested?
Breaking Changes
While this change primarily enhances functionality without breaking existing behavior, there might be edge cases where applications rely on the current error behavior for paths containing slashes. However, such cases are expected to be rare.
Types of changes
Checklist
Additional context
While #159 marks this as a "bug," there is an existing test case suggesting this might have been intentional behavior:
python-sdk/tests/issues/test_141_resource_templates.py
Lines 61 to 64 in f10665d
I would appreciate maintainers' input on the intended behavior. If rejecting slash-containing values is the desired design, please close this PR.