Skip to content

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

Description

@Kludex

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 functionparameters {'ctx'}

When I have this resource:

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

It seems the ctx is not being taken in consideration.

cc @jlowin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions