Title: Use shared `is_async_callable` instead of `inspect.iscoroutinefunction` by Kludex · Pull Request #2389 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Use shared `is_async_callable` instead of `inspect.iscoroutinefunction` by Kludex · Pull Request #2389 · modelcontextprotocol/python-sdk
X Title: Use shared `is_async_callable` instead of `inspect.iscoroutinefunction` by Kludex · Pull Request #2389 · modelcontextprotocol/python-sdk
Description: Summary inspect.iscoroutinefunction misses callable objects with an async __call__ and functools.partial-wrapped coroutines. The tools/base.py module already had a local _is_async_callable helper that handles these cases, but the prompts, resources, and templates modules were using the raw inspect.iscoroutinefunction. This PR extracts the helper into mcp.shared._callable_inspection.is_async_callable (adapted from Starlette's implementation) and replaces all inspect.iscoroutinefunction usage across the codebase. Test plan All 333 mcpserver tests pass pyright clean on all changed files ruff lint + format clean
Open Graph Description: Summary inspect.iscoroutinefunction misses callable objects with an async __call__ and functools.partial-wrapped coroutines. The tools/base.py module already had a local _is_async_callable helper t...
X Description: Summary inspect.iscoroutinefunction misses callable objects with an async __call__ and functools.partial-wrapped coroutines. The tools/base.py module already had a local _is_async_callable helper t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2389
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:caec6e61-b782-71cc-f7ca-2272b55f673b |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9BD2:CB8D0:A38ADF:EBFBF9:6A59F99A |
| html-safe-nonce | 84cd52e4550cd82a57d325a1c111bd71905dfac3a60ed82754237003a0034a99 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkQyOkNCOEQwOkEzOEFERjpFQkZCRjk6NkE1OUY5OUEiLCJ2aXNpdG9yX2lkIjoiMjY0NjkzMTQ3MjM1MjE0Nzg2NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d90561bca4e9d22db1ab2df6e32a964f7eaa7d5e72d7085616cdca71ec7d7803 |
| hovercard-subject-tag | pull_request:3486648290 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/modelcontextprotocol/python-sdk/pull/2389/files |
| twitter:image | https://avatars.githubusercontent.com/u/7353520?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/7353520?s=400&v=4 |
| og:image:alt | Summary inspect.iscoroutinefunction misses callable objects with an async __call__ and functools.partial-wrapped coroutines. The tools/base.py module already had a local _is_async_callable helper t... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 24801cf86623a319252348d1fd69122ad974b842 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width