Skip to content
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

@app.resource() does not accept ctx: Context #244

Open
Kludex opened this issue Mar 6, 2025 · 0 comments
Open

@app.resource() does not accept ctx: Context #244

Kludex opened this issue Mar 6, 2025 · 0 comments

Comments

@Kludex
Copy link

Kludex commented Mar 6, 2025

I'm having this exception:

Traceback (most recent call last):
  File "/Users/marcelotryle/dev/pydantic/logfire-mcp/main.py", line 121, in <module>
    @mcp.resource("schema://records")
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/marcelotryle/dev/pydantic/logfire-mcp/.venv/lib/python3.12/site-packages/mcp/server/fastmcp/server.py", line 383, in decorator
    raise ValueError(
ValueError: Mismatch between URI parameters set() and function parameters {'ctx'}

When I have this resource:

@mcp.resource("schema://records")
async def get_logfire_records_schema(ctx: Context) -> str: ...

It seems the ctx is not being taken in consideration.

cc @jlowin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant