René's URL Explorer Experiment


Title: Client treats JSON-null structuredContent as missing, skipping outputSchema validation · Issue #3345 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Client treats JSON-null structuredContent as missing, skipping outputSchema validation · Issue #3345 · modelcontextprotocol/python-sdk

X Title: Client treats JSON-null structuredContent as missing, skipping outputSchema validation · Issue #3345 · 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/3345

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.4


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Client treats JSON-null structuredContent as missing, skipping outputSchema validation","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\nOn current `main` (`57394b0548d1e2dc2dce8d67d84985769df3b8bb`), `ClientSession.validate_tool_result` treats `structured_content is None` as \"the tool did not return structured content\".\n\nThat collapses two different wire shapes:\n\n1. omitted `structuredContent` (field absent)\n2. explicit JSON `null` (`\"structuredContent\": null`)\n\nSEP-2106 / spec 2026-07-28 allow `structuredContent` to be any JSON value, including `null`. The TypeScript SDK already checks `=== undefined` (not falsy / not null) for this reason.\n\nPydantic stores both omitted and JSON null as `None`. `model_fields_set` distinguishes them: a `CallToolResult` parsed from `{\"content\": [], \"structuredContent\": null}` has `\"structured_content\" in model_fields_set`, while an omitted field does not.\n\n**What happens today**\n\n- Tool advertises `\"outputSchema\": {\"type\": \"null\"}` (or `{\"type\": [\"object\", \"null\"], ...}`).\n- Server returns `\"structuredContent\": null`.\n- Client raises `Tool {name} has an output schema but did not return structured content` and never runs jsonschema against the value.\n\n**What I expected**\n\n- Omitted `structuredContent` still raises the existing missing-field error.\n- Explicit JSON null is validated against the advertised schema: accept if the schema allows null, reject as a schema mismatch if it does not.\n- Falsy JSON values (`0`, `false`, `\"\"`) stay validated (they already are, because the current check is `is None` rather than falsy).\n\nThis is not #3224 (server injecting nulls for `NotRequired` keys). That issue is about serializing omitted object keys as null. This one is the client presence check before `outputSchema` validation.\n\nI hit this while checking official SDK conformance of declared `outputSchema` against `structuredContent`. I have a small backwards-compatible test and fix ready and would like to send the PR if a maintainer wants it.\n\nAI assistance: researched and drafted with Grok 4.6; I reviewed the spec text, the TypeScript v2 presence check, and the Pydantic `model_fields_set` behavior before filing.\n\n### Example Code\n\n```python\nfrom mcp_types import CallToolResult\n\nomitted = CallToolResult.model_validate({\"content\": []})\nexplicit_null = CallToolResult.model_validate({\"content\": [], \"structuredContent\": None})\n\nassert omitted.structured_content is None\nassert explicit_null.structured_content is None\nassert \"structured_content\" not in omitted.model_fields_set\nassert \"structured_content\" in explicit_null.model_fields_set\n```\n\nAgainst a tool whose `outputSchema` is `{\"type\": \"null\"}`, `validate_tool_result` currently raises the missing-field RuntimeError for `explicit_null`. After a presence check that uses `model_fields_set`, that result validates.\n\n### Python & MCP Python SDK\n\n- Python 3.12\n- MCP Python SDK `main` at `57394b0548d1e2dc2dce8d67d84985769df3b8bb` (2.x)","author":{"url":"https://github.com/epistemedeus","@type":"Person","name":"epistemedeus"},"datePublished":"2026-08-20T17:21:47Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3345"}

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:14e1c52c-2a37-f63f-4361-8ec5c2ce3ec6
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9C44:12E8E1:11871B3:17F694A:6B0563F8
html-safe-nonceabc68acb1d49a46bfc8b0da5a069b167b8afb21966b26a1b9b66011391715971
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QzQ0OjEyRThFMToxMTg3MUIzOjE3RjY5NEE6NkIwNTYzRjgiLCJ2aXNpdG9yX2lkIjoiMjUxMTQwNjg4NDU5OTQ1Njc2MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmaca26fa53131f3fe394a03c43df63f7b90d0970b4f758e72cdb8c027eb6018c05b
hovercard-subject-tagissue:5206097349
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/3345/issue_layout
twitter:imagehttps://opengraph.githubassets.com/23272027af8ca71921f275b64e84ae09e5035d4da7085ede8bd5f963e0416f64/modelcontextprotocol/python-sdk/issues/3345
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/23272027af8ca71921f275b64e84ae09e5035d4da7085ede8bd5f963e0416f64/modelcontextprotocol/python-sdk/issues/3345
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:usernameepistemedeus
hostnamegithub.com
expected-hostnamegithub.com
None1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331
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
releasef6d69234e682c947a48074340e69d45d5901de31
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/issues/3345#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fissues%2F3345
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%2F3345
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/3345
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3345
Reloadhttps://github.com/modelcontextprotocol/python-sdk/issues/3345
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/3345
New issuehttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3345
#3621https://github.com/modelcontextprotocol/python-sdk/pull/3621
Client treats JSON-null structuredContent as missing, skipping outputSchema validationhttps://github.com/modelcontextprotocol/python-sdk/issues/3345#top
#3621https://github.com/modelcontextprotocol/python-sdk/pull/3621
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
https://github.com/epistemedeus
epistemedeushttps://github.com/epistemedeus
on Aug 20, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#issue-5206097349
https://github.com/modelcontextprotocol/python-sdk/issueshttps://github.com/modelcontextprotocol/python-sdk/issues
#3224https://github.com/modelcontextprotocol/python-sdk/issues/3224
claudehttps://github.com/apps/claude
v2https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22v2%22
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%22
on Aug 20, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#event-29759383522
https://github.com/Ben-Home
Ben-Homehttps://github.com/Ben-Home
on Aug 21, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#issuecomment-5372909762
https://github.com/lucianoon
lucianoonhttps://github.com/lucianoon
on Aug 27, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#issuecomment-5443339061
https://github.com/lucianoon/mcp-python-sdk/tree/fix/structured-content-explicit-nullhttps://github.com/lucianoon/mcp-python-sdk/tree/fix/structured-content-explicit-null
https://github.com/Alqudimi
Alqudimihttps://github.com/Alqudimi
on Aug 27, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#issuecomment-5445059969
maxisbeyhttps://github.com/maxisbey
completedhttps://github.com/modelcontextprotocol/python-sdk/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#3621https://github.com/modelcontextprotocol/python-sdk/pull/3621
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#event-32332850697
https://github.com/maxisbey
maxisbeyhttps://github.com/maxisbey
on Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/issues/3345#issuecomment-5957044035
#3621https://github.com/modelcontextprotocol/python-sdk/pull/3621
#3346https://github.com/modelcontextprotocol/python-sdk/pull/3346
AI Disclaimerhttps://gist.github.com/maxisbey/6123d132484e4c533eab519a2800693d
Sign up for freehttps://github.com/signup?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3345
Sign in to commenthttps://github.com/login?return_to=https://github.com/modelcontextprotocol/python-sdk/issues/3345
spec-2026-07-28https://github.com/modelcontextprotocol/python-sdk/issues?q=state%3Aopen%20label%3A%22spec-2026-07-28%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.