Title: Add type annotations for all server decorators (list_tools, list_resources, read_resource) · Issue #1980 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Add type annotations for all server decorators (list_tools, list_resources, read_resource) · Issue #1980 · modelcontextprotocol/python-sdk
X Title: Add type annotations for all server decorators (list_tools, list_resources, read_resource) · Issue #1980 · modelcontextprotocol/python-sdk
Description: Summary Following #1822 and #1826 which addressed call_tool decorator typing, the other server decorators still lack proper type annotations, requiring # type: ignore comments in strict mypy projects. Affected Decorators @server.list_too...
Open Graph Description: Summary Following #1822 and #1826 which addressed call_tool decorator typing, the other server decorators still lack proper type annotations, requiring # type: ignore comments in strict mypy projec...
X Description: Summary Following #1822 and #1826 which addressed call_tool decorator typing, the other server decorators still lack proper type annotations, requiring # type: ignore comments in strict mypy projec...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1980
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add type annotations for all server decorators (list_tools, list_resources, read_resource)","articleBody":"## Summary\n\nFollowing #1822 and #1826 which addressed `call_tool` decorator typing, the other server decorators still lack proper type annotations, requiring `# type: ignore` comments in strict mypy projects.\n\n## Affected Decorators\n\n- `@server.list_tools()`\n- `@server.list_resources()`\n- `@server.read_resource()`\n\n## Current Behavior\n\n```python\n@server.list_tools() # type: ignore[no-untyped-call, untyped-decorator]\nasync def list_tools() -\u003e list[Tool]:\n ...\n\n@server.list_resources() # type: ignore[no-untyped-call, untyped-decorator]\nasync def list_resources() -\u003e list[Resource]:\n ...\n\n@server.read_resource() # type: ignore[no-untyped-call, untyped-decorator]\nasync def read_resource(uri: str) -\u003e str:\n ...\n```\n\nRunning mypy in strict mode produces:\n```\nerror: Call to untyped function \"list_tools\" in typed context [no-untyped-call]\nerror: Untyped decorator makes function \"list_tools\" untyped [untyped-decorator]\n```\n\n## Expected Behavior\n\nAll server decorators should preserve type information using `ParamSpec` (as done for `call_tool` in #1826), eliminating the need for `type: ignore` comments.\n\n## Environment\n\n- mcp version: 1.26.0\n- Python: 3.14\n- mypy: strict mode\n\n## Related\n\n- #1822 - Original issue for `call_tool`\n- #1826 - Fix for `call_tool` decorator","author":{"url":"https://github.com/DaisukeYoda","@type":"Person","name":"DaisukeYoda"},"datePublished":"2026-01-31T18:32:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1980/python-sdk/issues/1980"}
| 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:03bd53d2-5b95-27cd-941c-92f8c7f67b32 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A3E4:257F3:1120731:1689D65:6A5C47A7 |
| html-safe-nonce | d15e57ceb3c91f7d8a744660c7643e85e3f5307808a5b6db401fdbb638ea5175 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBM0U0OjI1N0YzOjExMjA3MzE6MTY4OUQ2NTo2QTVDNDdBNyIsInZpc2l0b3JfaWQiOiI2MTc1MDQxNzg1MTA0NzEzNjM5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ff4a1e0f2d0e7e9bb01fd8ff7d1e6d2b4962b170b6dc64391524f229db816483 |
| hovercard-subject-tag | issue:3879779910 |
| 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/1980/issue_layout |
| twitter:image | https://opengraph.githubassets.com/57d8529e8163b3fbd37c312355d203fe4562ed23b6751ddff702d751810a4fbd/modelcontextprotocol/python-sdk/issues/1980 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/57d8529e8163b3fbd37c312355d203fe4562ed23b6751ddff702d751810a4fbd/modelcontextprotocol/python-sdk/issues/1980 |
| og:image:alt | Summary Following #1822 and #1826 which addressed call_tool decorator typing, the other server decorators still lack proper type annotations, requiring # type: ignore comments in strict mypy projec... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DaisukeYoda |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| 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 | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width