René's URL Explorer Experiment


Title: typing.Dict[str, X] return annotation is wrapped in {"result": ...}, unlike dict[str, X] · Issue #3745 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: typing.Dict[str, X] return annotation is wrapped in {"result": ...}, unlike dict[str, X] · Issue #3745 · modelcontextprotocol/python-sdk

X Title: typing.Dict[str, X] return annotation is wrapped in {"result": ...}, unlike dict[str, X] · Issue #3745 · modelcontextprotocol/python-sdk

Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before openi...

Open Graph Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontex...

X Description: Initial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/mod...

Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3745

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"typing.Dict[str, X] return annotation is wrapped in {\"result\": ...}, unlike dict[str, X]","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1)\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Release line\n\n2.x (current stable)\n\n### Description\n\n`-> typing.Dict[str, Any]` and `-> dict[str, Any]` are the same type, but `MCPServer` gives them different output schemas and different `structuredContent`:\n\n- `-> dict[str, Any]`: `outputSchema` is the object itself (`{\"type\": \"object\", \"additionalProperties\": true, ...}`) and the result is `{\"ok\": true}`.\n- `-> typing.Dict[str, Any]`: the result is wrapped, so `outputSchema` is `{\"properties\": {\"result\": {...}}, \"required\": [\"result\"], ...}` and the result is `{\"result\": {\"ok\": true}}`.\n\nSo modernising annotations changes what a tool returns on the wire. Ruff's UP006 (and pyupgrade) rewrite `Dict` to `dict` automatically, and that silently changed one of our tools' output shape. A client that had cached the tool's earlier output schema then rejected its results.\n\n**Expected:** both spellings behave like `dict[str, Any]` does today (and `typing.List[...]`, `typing.Tuple[...]` like their builtin forms).\n\n**Cause:** in `_create_output_model` (`src/mcp/server/mcpserver/utilities/func_metadata.py`), the generic branch is `elif isinstance(type_expr, GenericAlias):`, with `GenericAlias` from `types`. `typing.Dict[str, Any]` is a `typing._GenericAlias`, not a `types.GenericAlias`, so it skips the `origin is dict` case and falls through to the final `else`, which wraps it.\n\n**Possible fix:** test the origin instead of the alias class, e.g. `elif get_origin(type_expr) is not None:`. The other generics that reach the final `else` today (Union, Optional, Literal, ...) all have an origin other than `dict`, so they would still be wrapped as now. I'm happy to send a PR with tests if a maintainer assigns this to me.\n\nRelated, but different: #3725 is about bare `dict`/`list`/`tuple` without parameters.\n\n### Example Code\n\n```Python\nimport asyncio\nimport typing\n\nfrom mcp.server.mcpserver import MCPServer\n\nserver = MCPServer(name=\"repro\")\n\n\n@server.tool()\ndef typing_dict() -> typing.Dict[str, typing.Any]:\n    return {\"ok\": True}\n\n\n@server.tool()\ndef builtin_dict() -> dict[str, typing.Any]:\n    return {\"ok\": True}\n\n\nasync def main() -> None:\n    tools = {tool.name: tool for tool in await server.list_tools()}\n    for name in (\"typing_dict\", \"builtin_dict\"):\n        result = await server.call_tool(name, {})\n        print(name, tools[name].output_schema, result.structured_content)\n\n\nasyncio.run(main())\n```\n\nOutput:\n\n```\ntyping_dict {'properties': {'result': {'additionalProperties': True, 'title': 'Result', 'type': 'object'}}, 'required': ['result'], 'title': 'typing_dictOutput', 'type': 'object'} {'result': {'ok': True}}\nbuiltin_dict {'additionalProperties': True, 'title': 'builtin_dictDictOutput', 'type': 'object'} {'ok': True}\n```\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.12\nmcp 2.3.0 (also on main: func_metadata.py still uses isinstance(type_expr, GenericAlias))\n```\n\nAI-assisted report.\n","author":{"url":"https://github.com/benjamin-di","@type":"Person","name":"benjamin-di"},"datePublished":"2026-10-23T08:06:03Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3745"}

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:af607ffc-d20d-49cd-da2c-83b2d5eb7aac
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD806:F7F6B:398E1C:51B3B9:6B05B3A4
html-safe-nonce32b59917e1b3daf38d9a74643273ab2e31447125b0e81d54eb8e3e17d95813a0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODA2OkY3RjZCOjM5OEUxQzo1MUIzQjk6NkIwNUIzQTQiLCJ2aXNpdG9yX2lkIjoiODA0NDA3MjgwMzQxNjUxOTU4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac515d71d5f3cd044a1e8fce090aa9b36b986b2a939a17fe42d438193bf4c7e7c6
hovercard-subject-tagissue:5994238545
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/modelcontextprotocol/python-sdk/3745/issue_layout
twitter:imagehttps://opengraph.githubassets.com/3b33e5e6a2a98608c9653b58ea2f2ac5738cc56c7135f81061f7f030171803cf/modelcontextprotocol/python-sdk/issues/3745
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/3b33e5e6a2a98608c9653b58ea2f2ac5738cc56c7135f81061f7f030171803cf/modelcontextprotocol/python-sdk/issues/3745
og:image:altInitial Checks I confirm that I'm using the newest release of my line (the latest 2.x, or the latest 1.x if I'm still on v1) I confirm that I searched for my issue in https://github.com/modelcontex...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamebenjamin-di
hostnamegithub.com
expected-hostnamegithub.com
None106bb568ff143beb0075344f71b9097568f02130f2e85ac7ca2a4b82efb00b47
turbo-cache-controlno-preview
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
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseb207ef4132553ef1428fae8ca470a518d651ce07
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3745#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3745
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%2Fissues%2F3745
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=modelcontextprotocol%2Fpython-sdk
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3745
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3745
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3745
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
https://github.com/modelcontextprotocol/python-sdk
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3745
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3745
#3756https://github.com/modelcontextprotocol/python-sdk/pull/3756
typing.Dict[str, X] return annotation is wrapped in {"result": ...}, unlike dict[str, X]https://github.com/modelcontextprotocol/python-sdk/issues/3745#top
#3756https://github.com/modelcontextprotocol/python-sdk/pull/3756
bughttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v1https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/benjamin-di
benjamin-dihttps://github.com/benjamin-di
on Oct 23, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3745#issue-5994238545
https://github.com/modelcontextprotocol/python-sdk/issueshttps://github.com/modelcontextprotocol/python-sdk/issues
#3725https://github.com/modelcontextprotocol/python-sdk/issues/3725
claudehttps://github.com/apps/claude
bughttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
v1https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
on Oct 23, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3745#event-34033268199
Jihaochang1https://github.com/Jihaochang1
on Oct 23, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3745#event-34041471326
fix: use get_origin() for typing.GenericAlias detectionhttps://github.com/Jihaochang1/python-sdk/commit/a466c65e4bc470a80c70a7d363cbccf84d4313e8
https://docs.github.com/articles/closing-issues-via-commit-messages
a466c65https://github.com/Jihaochang1/python-sdk/commit/a466c65e4bc470a80c70a7d363cbccf84d4313e8
https://github.com/Jihaochang1
Jihaochang1https://github.com/Jihaochang1
on Oct 23, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3745#issuecomment-6362898284
Kludexhttps://github.com/Kludex
completedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3756https://github.com/modelcontextprotocol/python-sdk/pull/3756
on Oct 24, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3745#event-34141517747
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3745
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3745
bughttps://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22bug%22
v1https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v1%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.