René's URL Explorer Experiment


Title: TypeVar-bound ADCPHandler for typed ToolContext subclasses · Issue #223 · adcontextprotocol/adcp-client-python · GitHub

Open Graph Title: TypeVar-bound ADCPHandler for typed ToolContext subclasses · Issue #223 · adcontextprotocol/adcp-client-python

X Title: TypeVar-bound ADCPHandler for typed ToolContext subclasses · Issue #223 · adcontextprotocol/adcp-client-python

Description: Summary ToolContext supports subclassing (the docstring in adcp.server.base explicitly invites it for multi-tenant agents carrying typed adapter handles, testing hooks, etc.). The context_factory hook lets downstream return their subclas...

Open Graph Description: Summary ToolContext supports subclassing (the docstring in adcp.server.base explicitly invites it for multi-tenant agents carrying typed adapter handles, testing hooks, etc.). The context_factory h...

X Description: Summary ToolContext supports subclassing (the docstring in adcp.server.base explicitly invites it for multi-tenant agents carrying typed adapter handles, testing hooks, etc.). The context_factory h...

Opengraph URL: https://github.com/adcontextprotocol/adcp-client-python/issues/223

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeVar-bound ADCPHandler for typed ToolContext subclasses","articleBody":"## Summary\n\n`ToolContext` supports subclassing (the docstring in `adcp.server.base` explicitly invites it for multi-tenant agents carrying typed adapter handles, testing hooks, etc.). The `context_factory` hook lets downstream return their subclass at runtime. But the static-type story stops there: every `ADCPHandler` method signature declares `context: ToolContext | None`, so handlers that take a subclass-specific field have to `cast()` or `isinstance()` at every call site.\n\nArchitect on PR #219 review:\n> The docstring encourages subclassing, but nothing rewards it — the factory return type is `ToolContext`, not `TContext = TypeVar(bound=ToolContext)`. Handlers that subclass still get `ToolContext` in their type hints. Add the TypeVar; it's a one-line change that turns the encouragement into a contract.\n\nThe architect undersold the change size (it's more than one line because `ADCPHandler` has 57+ method signatures), but the intent holds.\n\n## Proposed fix\n\n```python\nTContext = TypeVar(\\\"TContext\\\", bound=ToolContext)\n\nclass ADCPHandler(ABC, Generic[TContext]):\n    async def get_products(\n        self, params: GetProductsRequest | dict[str, Any], context: TContext | None = None\n    ) -> Any: ...\n```\n\nSubclasses parameterize: `class SalesAgentHandler(ADCPHandler[SalesAgentContext])`. Factories that return `SalesAgentContext` narrow the handler's inbound type. No runtime behavior change.\n\n## Tradeoffs\n\n- Every existing subclass gains the option to parameterize but must keep working without it (default `TContext = ToolContext`). mypy may need a few `# type: ignore` touches during migration.\n- 57+ method signatures across `ADCPHandler`, `GovernanceHandler`, `ContentStandardsHandler`, `SponsoredIntelligenceHandler`, `BrandHandler`, `TmpHandler`, `ComplianceHandler` each need the TypeVar threaded through. Invasive but mechanical.\n- Downstream that does `isinstance(context, MyContext)` today still works; the TypeVar just adds compile-time checks.\n\n## Context\n\nTracked from PR #219 expert architecture review. Deferred because the surgery touches every handler method signature — better to ship as its own PR than bundled with the tenant-scoping fix. Landing after #220 (advertised-tools gate) reduces the set of method signatures that need touching.","author":{"url":"https://github.com/bokelley","@type":"Person","name":"bokelley"},"datePublished":"2026-04-20T06:04:38Z","url":"https://github.com/adcontextprotocol/adcp-client-python/issues/223"}

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/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:04f67a45-9347-43c5-c521-d1fed8f83239
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD1AE:63875:BC166F:FA7BF5:6B00F26F
html-safe-nonce51ffd2cb252e92eff7ec900f405483208cf4298f933183d620cbc7098337a4af
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMUFFOjYzODc1OkJDMTY2RjpGQTdCRjU6NkIwMEYyNkYiLCJ2aXNpdG9yX2lkIjoiNzkzNjUxNjA2MzQzMTI5MTUwMyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac7ae0288912b797699c7c7c3016c10a9e65263a89a729c0f9497b10284be50aef
hovercard-subject-tagissue:4293463665
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/adcontextprotocol/adcp-client-python/223/issue_layout
twitter:imagehttps://opengraph.githubassets.com/9a57eca2d68362351a32d2e051491a0f4bb7a6007825beea9eba534502ee23f2/adcontextprotocol/adcp-client-python/issues/223
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/9a57eca2d68362351a32d2e051491a0f4bb7a6007825beea9eba534502ee23f2/adcontextprotocol/adcp-client-python/issues/223
og:image:altSummary ToolContext supports subclassing (the docstring in adcp.server.base explicitly invites it for multi-tenant agents carrying typed adapter handles, testing hooks, etc.). The context_factory h...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebokelley
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/adcontextprotocol/adcp-client-python git https://github.com/adcontextprotocol/adcp-client-python.git
octolytics-dimension-user_id221690821
octolytics-dimension-user_loginadcontextprotocol
octolytics-dimension-repository_id1090305973
octolytics-dimension-repository_nwoadcontextprotocol/adcp-client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1090305973
octolytics-dimension-repository_network_root_nwoadcontextprotocol/adcp-client-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/adcontextprotocol/adcp-client-python/issues/223#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F223
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%2Fadcontextprotocol%2Fadcp-client-python%2Fissues%2F223
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=adcontextprotocol%2Fadcp-client-python
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/223
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/223
Reloadhttps://github.com/adcontextprotocol/adcp-client-python/issues/223
adcontextprotocolhttps://github.com/adcontextprotocol
adcp-client-pythonhttps://github.com/adcontextprotocol/adcp-client-python
Codehttps://github.com/adcontextprotocol/adcp-client-python
Issues44 (44)https://github.com/adcontextprotocol/adcp-client-python/issues
Pull requests13 (13)https://github.com/adcontextprotocol/adcp-client-python/pulls
Actionshttps://github.com/adcontextprotocol/adcp-client-python/actions
Projectshttps://github.com/adcontextprotocol/adcp-client-python/projects
Security and qualityhttps://github.com/adcontextprotocol/adcp-client-python/security
Insightshttps://github.com/adcontextprotocol/adcp-client-python/insights
https://github.com/adcontextprotocol/adcp-client-python
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/223
New issuehttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/223
#177https://github.com/adcontextprotocol/adcp-client-python/pull/177
#234https://github.com/adcontextprotocol/adcp-client-python/pull/234
TypeVar-bound ADCPHandler for typed ToolContext subclasseshttps://github.com/adcontextprotocol/adcp-client-python/issues/223#top
#177https://github.com/adcontextprotocol/adcp-client-python/pull/177
#234https://github.com/adcontextprotocol/adcp-client-python/pull/234
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on Apr 20, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#issue-4293463665
#219https://github.com/adcontextprotocol/adcp-client-python/pull/219
#219https://github.com/adcontextprotocol/adcp-client-python/pull/219
#220https://github.com/adcontextprotocol/adcp-client-python/issues/220
bokelleyhttps://github.com/bokelley
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
on Apr 20, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#event-24663711227
https://github.com/bokelley
bokelleyhttps://github.com/bokelley
on Apr 20, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#issuecomment-4278264314
bokelleyhttps://github.com/bokelley
on Apr 20, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#event-24678547089
feat(server): TypeVar-bound ADCPHandler for typed ToolContext subclas…https://github.com/adcontextprotocol/adcp-client-python/commit/e1eb92350e9872cfadbff4bff6a274a49af59c83
https://docs.github.com/articles/closing-issues-via-commit-messages
e1eb923https://github.com/adcontextprotocol/adcp-client-python/commit/e1eb92350e9872cfadbff4bff6a274a49af59c83
Merge pull request #234 from adcontextprotocol/bokelley/typevar-adcph…https://github.com/adcontextprotocol/adcp-client-python/commit/d737527027fcf5b77ba40c4502251449633f059d
#234https://github.com/adcontextprotocol/adcp-client-python/pull/234
https://docs.github.com/articles/closing-issues-via-commit-messages
d737527https://github.com/adcontextprotocol/adcp-client-python/commit/d737527027fcf5b77ba40c4502251449633f059d
bokelleyhttps://github.com/bokelley
completedhttps://github.com/adcontextprotocol/adcp-client-python/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#234https://github.com/adcontextprotocol/adcp-client-python/pull/234
on Apr 20, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#event-24680489322
KonstantinMirinhttps://github.com/KonstantinMirin
on May 13, 2026https://github.com/adcontextprotocol/adcp-client-python/issues/223#event-25486654800
feat(server): AccountAwareToolContext + multi-tenant contract dochttps://github.com/KonstantinMirin/adcp-client-python/commit/3747939427e77b391bd9444beaa60c8b2f72e425
3747939https://github.com/KonstantinMirin/adcp-client-python/commit/3747939427e77b391bd9444beaa60c8b2f72e425
Sign up for freehttps://github.com/signup?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/223
Sign in to commenthttps://github.com/login?return_to=https://github.com/adcontextprotocol/adcp-client-python/issues/223
enhancementNew feature or requesthttps://github.com/adcontextprotocol/adcp-client-python/issues?q=state%3Aopen%20label%3A%22enhancement%22
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

Viewport: width=device-width


URLs of crawlers that visited me.