René's URL Explorer Experiment


Title: Bare `dict` / `list` / `tuple` return annotations silently produce no structured output · Issue #3725 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Bare `dict` / `list` / `tuple` return annotations silently produce no structured output · Issue #3725 · modelcontextprotocol/python-sdk

X Title: Bare `dict` / `list` / `tuple` return annotations silently produce no structured output · Issue #3725 · 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/3725

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bare `dict` / `list` / `tuple` return annotations silently produce no structured output","articleBody":"### Initial Checks\r\n\r\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)\r\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\r\n\r\n### Release line\r\n\r\n2.x (current stable)\r\n\r\n### Description\r\n\r\nA tool annotated with a bare `dict` (or `list` / `tuple`) gets no `outputSchema` and no `structuredContent`. The result only arrives as JSON text. `-> dict[str, Any]` works, and `-> str` gets `{\"result\": ...}`. With `structured_output=True` the bare annotation raises `InvalidSignature: Function f: return type \u003cclass 'dict'> is not serializable for structured output`, which reads as if a dict weren't serializable.\r\n\r\n**Expected:** `-> dict` behaves like `dict[str, Any]`, and `-> list` / `-> tuple` like `list[Any]` (wrapped in `{\"result\": ...}`). Failing that, the structured-output docs could say that bare containers opt out.\r\n\r\n**Cause:** `_create_output_model` sends bare `dict` / `list` / `tuple` to the \"other class types\" case. `get_type_hints(dict)` is empty, so the model stays `None`: the silent opt-out documented for classes without type hints, which isn't obvious for builtins. We hit it while building an MCP server: our tools were `-> dict`, and our client code expected `structured_content` that was always `None`.\r\n\r\n**Proposed fix:** a case before the class fallback that sends bare `dict` down the `dict[str, ...]` path and wraps bare `list` / `tuple` like their generic forms, plus a test and one sentence in `docs/servers/structured-output.md`. It's about 10 lines of code, and the full suite passes (6206 passed). One behaviour change to weigh: existing bare `-> dict` / `-> list` tools would start publishing an `outputSchema` and validating their results.\r\n\r\nI'd like to send this as a PR if you're open to it. It's on a branch: https://github.com/g-s-jithesh/python-sdk/commit/6ecfa04ece6032816c7d3a087fd8c841cb0c43e1\r\n\r\nI used an AI coding assistant (Claude Code) to help investigate this and draft the fix. I reproduced the bug myself and reviewed the change.\r\n\r\n### Example Code\r\n\r\n```Python\r\nimport asyncio\r\nfrom typing import Any\r\n\r\nfrom mcp import Client\r\nfrom mcp.server.mcpserver import MCPServer\r\n\r\nmcp = MCPServer(\"repro\")\r\n\r\n\r\n@mcp.tool()\r\ndef bare() -> dict:\r\n    return {\"id\": 1}\r\n\r\n\r\n@mcp.tool()\r\ndef typed() -> dict[str, Any]:\r\n    return {\"id\": 1}\r\n\r\n\r\nasync def main() -> None:\r\n    async with Client(mcp) as client:\r\n        for name in (\"bare\", \"typed\"):\r\n            print(name, (await client.call_tool(name, {})).structured_content)\r\n\r\n\r\nasyncio.run(main())\r\n# bare None\r\n# typed {'id': 1}\r\n```\r\n\r\n### Python & MCP Python SDK\r\n\r\n```Text\r\nPython 3.14, Windows 11; mcp 2.3.0, and main at 9f66f37 (src/mcp/server/mcpserver/utilities/func_metadata.py, _create_output_model)\r\n```\r\n","author":{"url":"https://github.com/g-s-jithesh","@type":"Person","name":"g-s-jithesh"},"datePublished":"2026-10-17T12:21:26Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3725"}

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:300e5f34-aa8d-c8ab-3b2b-88074ebb487a
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE316:2CC991:37B594:4E8CE5:6B05B3A6
html-safe-noncec19617ddad464ce37d073ad287e13b06fb71e51950e83c5f1a0a925a6494fc71
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMzE2OjJDQzk5MTozN0I1OTQ6NEU4Q0U1OjZCMDVCM0E2IiwidmlzaXRvcl9pZCI6IjMyMTQzNDkxNzEwMjUwOTc2MzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacf46cf061792e9f4d6dc1c2b54dd679ed01be5a2386597b886105b733aa953869
hovercard-subject-tagissue:5898266933
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/3725/issue_layout
twitter:imagehttps://opengraph.githubassets.com/87c70bfb6d2401655f4abaea25d7e4d377e1164ca7d908fd42c168aced9a293e/modelcontextprotocol/python-sdk/issues/3725
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/87c70bfb6d2401655f4abaea25d7e4d377e1164ca7d908fd42c168aced9a293e/modelcontextprotocol/python-sdk/issues/3725
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:usernameg-s-jithesh
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/3725#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3725
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%2F3725
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/3725
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3725
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3725
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/3725
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3725
#3758https://github.com/modelcontextprotocol/python-sdk/pull/3758
Bare dict / list / tuple return annotations silently produce no structured outputhttps://github.com/modelcontextprotocol/python-sdk/issues/3725#top
#3758https://github.com/modelcontextprotocol/python-sdk/pull/3758
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/g-s-jithesh
g-s-jitheshhttps://github.com/g-s-jithesh
on Oct 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#issue-5898266933
https://github.com/modelcontextprotocol/python-sdk/issueshttps://github.com/modelcontextprotocol/python-sdk/issues
g-s-jithesh@6ecfa04https://github.com/g-s-jithesh/python-sdk/commit/6ecfa04ece6032816c7d3a087fd8c841cb0c43e1
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 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#event-33519498584
https://github.com/xuilen
xuilenhttps://github.com/xuilen
on Oct 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#issuecomment-6234528617
https://github.com/g-s-jithesh
g-s-jitheshhttps://github.com/g-s-jithesh
on Oct 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#issuecomment-6234729340
main...g-s-jithesh:python-sdk:fix/bare-container-structured-outputhttps://github.com/modelcontextprotocol/python-sdk/compare/main...g-s-jithesh:python-sdk:fix/bare-container-structured-output
https://github.com/xuilen
xuilenhttps://github.com/xuilen
on Oct 17, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#issuecomment-6235147972
https://github.com/adilKhan72
adilKhan72https://github.com/adilKhan72
on Oct 18, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#issuecomment-6254880871
Kludexhttps://github.com/Kludex
completedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3758https://github.com/modelcontextprotocol/python-sdk/pull/3758
on Oct 24, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3725#event-34147653624
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3725
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3725
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.