René's URL Explorer Experiment


Title: fix: detect context on callable tool objects by fengjikui · Pull Request #2817 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: fix: detect context on callable tool objects by fengjikui · Pull Request #2817 · modelcontextprotocol/python-sdk

X Title: fix: detect context on callable tool objects by fengjikui · Pull Request #2817 · modelcontextprotocol/python-sdk

Description: Fixes #1974. Summary find_context_parameter() previously inspected callable object instances directly with typing.get_type_hints(). For instances that implement __call__, those type hints live on the bound __call__ method, so a ctx: Context parameter was not detected. That meant callable-object tools exposed ctx as a required external tool argument instead of letting the framework inject it. This updates context detection to inspect fn.__call__ for callable objects while preserving the existing path for regular functions and methods. It also adds regression coverage for both schema generation and runtime context injection on callable-object tools. Validation uv run --frozen pytest tests/server/mcpserver/test_tool_manager.py -q uv run --frozen ruff check src/mcp/server/mcpserver/utilities/context_injection.py tests/server/mcpserver/test_tool_manager.py uv run --frozen ruff format --check src/mcp/server/mcpserver/utilities/context_injection.py tests/server/mcpserver/test_tool_manager.py uv run --frozen pyright env -u ALL_PROXY -u HTTP_PROXY -u HTTPS_PROXY -u all_proxy -u http_proxy -u https_proxy ./scripts/test git diff --check This PR was prepared with AI assistance and manually validated with the checks above.

Open Graph Description: Fixes #1974. Summary find_context_parameter() previously inspected callable object instances directly with typing.get_type_hints(). For instances that implement __call__, those type hints live on t...

X Description: Fixes #1974. Summary find_context_parameter() previously inspected callable object instances directly with typing.get_type_hints(). For instances that implement __call__, those type hints live on t...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2817

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:d0208046-7ee5-69fd-9374-c8a6c7606c02
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idEA76:64377:2AC33B5:389B53F:6B056D6D
html-safe-nonce1cd5c6a94ca7c49109930e6923d79cee1b030d1010b4e3190d469cbcbc311cac
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQTc2OjY0Mzc3OjJBQzMzQjU6Mzg5QjUzRjo2QjA1NkQ2RCIsInZpc2l0b3JfaWQiOiIxODU2NzA0MjAxOTYzNjk1NDcwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmaca22d3e23092c2715ddfe71fe638afb079ed00972a81be444927420d5fca2ddcc
hovercard-subject-tagpull_request:3821130710
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2817/files
twitter:imagehttps://avatars.githubusercontent.com/u/56265583?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/56265583?s=400&v=4
og:image:altFixes #1974. Summary find_context_parameter() previously inspected callable object instances directly with typing.get_type_hints(). For instances that implement __call__, those type hints live on t...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9b4256ac5f3e310e7945ef5b71c9cb9e264357b1eb20e91d369ed6502a4c486c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git
octolytics-dimension-user_id182288589
octolytics-dimension-user_loginmodelcontextprotocol
octolytics-dimension-repository_id862584018
octolytics-dimension-repository_nwomodelcontextprotocol/python-sdk
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id862584018
octolytics-dimension-repository_network_root_nwomodelcontextprotocol/python-sdk
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasef089e689ad324655ac44bf6cdbc04d976105b374
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2817%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2817%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
modelcontextprotocolhttps://github.com/modelcontextprotocol
python-sdkhttps://github.com/modelcontextprotocol/python-sdk
Codehttps://github.com/modelcontextprotocol/python-sdk
Issues320 (320)https://github.com/modelcontextprotocol/python-sdk/issues
Pull requests112 (112)https://github.com/modelcontextprotocol/python-sdk/pulls
Actionshttps://github.com/modelcontextprotocol/python-sdk/actions
Projectshttps://github.com/modelcontextprotocol/python-sdk/projects
Security and quality12 (12)https://github.com/modelcontextprotocol/python-sdk/security
Insightshttps://github.com/modelcontextprotocol/python-sdk/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2Fnew%2Fchoose
fengjikuihttps://github.com/fengjikui
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
fengjikui:fix-callable-context-injectionhttps://github.com/fengjikui/python-sdk/tree/fix-callable-context-injection
Conversation 1 https://github.com/modelcontextprotocol/python-sdk/pull/2817
Commits 1 https://github.com/modelcontextprotocol/python-sdk/pull/2817/commits
Checks 27 https://github.com/modelcontextprotocol/python-sdk/pull/2817/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/2817/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
fix: detect context on callable tool objects https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#top
Show all changes 1 commit https://github.com/modelcontextprotocol/python-sdk/pull/2817/files
ff904b0 fix: detect context on callable tool objects fengjikui Jun 8, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2817/commits/ff904b035ed9dc37c01017d0824ef7a043508cc3
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/2817/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
context_injection.py https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-1b4ab7dd31f66da1830d323a66bff21b9b1a8d6d9220bc9f73bf2daee3bf3382
test_tool_manager.py https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-52a191f1e98e90ef36bd37740822f5c22a5d3ac583e52cda061b175b97fa1196
src/mcp/server/mcpserver/utilities/context_injection.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-1b4ab7dd31f66da1830d323a66bff21b9b1a8d6d9220bc9f73bf2daee3bf3382
View file https://github.com/fengjikui/python-sdk/blob/ff904b035ed9dc37c01017d0824ef7a043508cc3/src/mcp/server/mcpserver/utilities/context_injection.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2817/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-1b4ab7dd31f66da1830d323a66bff21b9b1a8d6d9220bc9f73bf2daee3bf3382
https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-1b4ab7dd31f66da1830d323a66bff21b9b1a8d6d9220bc9f73bf2daee3bf3382
tests/server/mcpserver/test_tool_manager.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-52a191f1e98e90ef36bd37740822f5c22a5d3ac583e52cda061b175b97fa1196
View file https://github.com/fengjikui/python-sdk/blob/ff904b035ed9dc37c01017d0824ef7a043508cc3/tests/server/mcpserver/test_tool_manager.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2817/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-52a191f1e98e90ef36bd37740822f5c22a5d3ac583e52cda061b175b97fa1196
https://github.com/modelcontextprotocol/python-sdk/pull/2817/files#diff-52a191f1e98e90ef36bd37740822f5c22a5d3ac583e52cda061b175b97fa1196
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2817/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.