-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@mcp.resource
with dynamic parameters example don't work
#68
Comments
Same for me, I copied the example server from from fastmcp import FastMCP
# Create an MCP server
mcp = FastMCP("Demo")
# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
"""Add two numbers"""
return a + b
# Add a dynamic greeting resource
@mcp.resource("greeting://{name}")
def get_greeting(name: str) -> str:
"""Get a personalized greeting"""
return f"Hello, {name}!"
if __name__ == "__main__":
mcp.run() Then started the inspector with: uv run fastmcp dev fastmcp.py I can see the
(btw it's a bit weird that the log is labelled as In history I have:
|
Anyone got a solution to this problem? Thanks. |
It appears to be an issue when there is a parameter for a resource. Resources without parameters appear to work fine. |
This is related to #10, the current version of |
@zzstoatzz thanks my bad, seems to be fixed but not released yet |
I'm having a similar issue on the official python-sdk. I can't get any resource params to show up in my MCP Inspector, might have to switch to native. 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}" |
In the README, there is an example:
This don't work
I can't see any resources in the mcp inspector
The text was updated successfully, but these errors were encountered: