Title: `@app.resource()` does not accept `ctx: Context` · Issue #244 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: `@app.resource()` does not accept `ctx: Context` · Issue #244 · modelcontextprotocol/python-sdk
X Title: `@app.resource()` does not accept `ctx: Context` · Issue #244 · modelcontextprotocol/python-sdk
Description: I'm having this exception: Traceback (most recent call last): File "/Users/marcelotryle/dev/pydantic/logfire-mcp/main.py", line 121, in
Open Graph Description: I'm having this exception: Traceback (most recent call last): File "/Users/marcelotryle/dev/pydantic/logfire-mcp/main.py", line 121, in
X Description: 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://rec...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/244
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"`@app.resource()` does not accept `ctx: Context`","articleBody":"I'm having this exception:\n\n```bash\nTraceback (most recent call last):\n File \"/Users/marcelotryle/dev/pydantic/logfire-mcp/main.py\", line 121, in \u003cmodule\u003e\n @mcp.resource(\"schema://records\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/marcelotryle/dev/pydantic/logfire-mcp/.venv/lib/python3.12/site-packages/mcp/server/fastmcp/server.py\", line 383, in decorator\n raise ValueError(\nValueError: Mismatch between URI parameters set() and function parameters {'ctx'}\n```\n\nWhen I have this resource:\n\n```py\n@mcp.resource(\"schema://records\")\nasync def get_logfire_records_schema(ctx: Context) -\u003e str: ...\n```\n\nIt seems the `ctx` is not being taken in consideration.\n\ncc @jlowin ","author":{"url":"https://github.com/Kludex","@type":"Person","name":"Kludex"},"datePublished":"2025-03-06T12:06:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":5},"url":"https://github.com/244/python-sdk/issues/244"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b081a621-34ea-66a7-6487-ab9196fa886e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C246:370E79:DF048:123FDE:6A5AC4E6 |
| html-safe-nonce | 74c6f3b8e90d9eab9c78c330940790debed64999eb68c3cf709e02968f8a1f31 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMjQ2OjM3MEU3OTpERjA0ODoxMjNGREU6NkE1QUM0RTYiLCJ2aXNpdG9yX2lkIjoiMzIwNTM2ODg4NDAyNDIzMTE0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d4f3e585c8c0186c30f4b7baa2e20586eb9c1e81f0ba3f065f273dce3642d9ca |
| hovercard-subject-tag | issue:2900224466 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/244/issue_layout |
| twitter:image | https://opengraph.githubassets.com/566c4d5c2e59d51c98c7738931266dfac4adc7dfd21fbcce3be3026d3c23fbd5/modelcontextprotocol/python-sdk/issues/244 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/566c4d5c2e59d51c98c7738931266dfac4adc7dfd21fbcce3be3026d3c23fbd5/modelcontextprotocol/python-sdk/issues/244 |
| og:image:alt | I'm having this exception: Traceback (most recent call last): File "/Users/marcelotryle/dev/pydantic/logfire-mcp/main.py", line 121, in |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Kludex |
| hostname | github.com |
| expected-hostname | github.com |
| None | f422022de939199d6afcbaac024b42b6232a3498a95f198e17717afb8b46fb15 |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2fa01ceb3b3a801409f050561abfb062094702d0 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width