René's URL Explorer Experiment


Title: Record JSON-RPC error responses on the client OpenTelemetry span by maxisbey · Pull Request #3629 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Record JSON-RPC error responses on the client OpenTelemetry span by maxisbey · Pull Request #3629 · modelcontextprotocol/python-sdk

X Title: Record JSON-RPC error responses on the client OpenTelemetry span by maxisbey · Pull Request #3629 · modelcontextprotocol/python-sdk

Description: Fixes #3174. When the peer answers a request with a JSON-RPC error, the client span (MCP send ) ends looking exactly like a success: status unset, no error attributes. The caller still gets its MCPError; only the trace is wrong. This records the error on the span. What was wrong send_raw_request receives the response inside the span, but an error response was only turned into MCPError after the span had closed, so the span never saw a failure. A timeout or a failed write on the same span was already ERROR, so the most common failure was the one missing from traces. The OpenTelemetry MCP semantic convention (Development status) says of the client span: "All JSON-RPC error codes SHOULD be considered errors." What changes In JSONRPCDispatcher.send_raw_request, an error response now sets the status and two attributes on the span while it is still open. The MCPError is raised where it was before. The "connection closed" outcome handed to waiting requests is now one shared module-level value, so the span can tell it apart from an error the peer sent, including one that uses the same code. No public API changes, and nothing changes on the wire. What users will notice A client span whose request was answered with a JSON-RPC error now has what the convention asks for: status ERROR, with the peer's error message as the description error.type set to the error code as a string (for example "-32602") rpc.response.status_code set to the same string, since the response contains an error code The same applies to requests a server sends to a client, such as sampling and elicitation. No exception event is added to the span, and the MCPError the caller receives is unchanged. The server/discover probe With the default mode="auto", each connect to a server that does not know server/discover now produces one ERROR client span for that probe, even though the connect succeeds. The request did fail, and the convention has no exception for it. A probe that times out was already ERROR before this change, so probe failures are now consistent. To filter these spans, match on the attribute mcp.method.name = server/discover. The error code is not a reliable key, because it varies by server and transport (-32601, -32602, -32600 and -32603 have all been seen). For a server known to be on an older protocol version, mode="legacy" sends no probe. What is not included A request abandoned because the connection closed while it was waiting keeps the span it has today (status unset). No response arrived, so there is no response code to record. Spans for timeouts, failed writes, cancelled calls and successful requests are as before. How it was checked New test in tests/shared/test_otel.py, driven through Client: a request the server answers with an error gets status ERROR, the message as the description, and both attributes; a successful request on the same connection stays unset. The test fails on main (the failed span is UNSET) and passes with the change. ./scripts/test passes with 100% coverage; ruff and pyright are clean. AI Disclaimer

Open Graph Description: Fixes #3174. When the peer answers a request with a JSON-RPC error, the client span (MCP send <method>) ends looking exactly like a success: status unset, no error attributes. The caller stil...

X Description: Fixes #3174. When the peer answers a request with a JSON-RPC error, the client span (MCP send &lt;method&gt;) ends looking exactly like a success: status unset, no error attributes. The cal...

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

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:b40fe334-4049-d06f-254a-c6861ea6879c
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id948C:1204FD:2A5363F:379EF0C:6B0564AA
html-safe-nonce396a2147935b06fe7a2052b17d022b3c0da2c8403432639d0cd2d588fab03bdb
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDhDOjEyMDRGRDoyQTUzNjNGOjM3OUVGMEM6NkIwNTY0QUEiLCJ2aXNpdG9yX2lkIjoiMTU5MTM1MTc2MzY4MzA3NTI0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmace716e306f9e8bd2a88896ed6995cdd2c7dcdf8d67fd20886ad1f1e4ca761da31
hovercard-subject-tagpull_request:4716988215
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/3629/files
twitter:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/224885523?s=400&v=4
og:image:altFixes #3174. When the peer answers a request with a JSON-RPC error, the client span (MCP send <method>) ends looking exactly like a success: status unset, no error attributes. The caller stil...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1be5cc09efdd4833c24a4ffa71d698e3999fa09071e159fe14c2c08e41c98331
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
releasef6d69234e682c947a48074340e69d45d5901de31
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F3629%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%2F3629%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/3629/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/3629/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
maxisbeyhttps://github.com/maxisbey
mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
3174-client-span-error-statushttps://github.com/modelcontextprotocol/python-sdk/tree/3174-client-span-error-status
Conversation 6 https://github.com/modelcontextprotocol/python-sdk/pull/3629
Commits 2 https://github.com/modelcontextprotocol/python-sdk/pull/3629/commits
Checks 35 https://github.com/modelcontextprotocol/python-sdk/pull/3629/checks
Files changed 2 https://github.com/modelcontextprotocol/python-sdk/pull/3629/files
Record JSON-RPC error responses on the client OpenTelemetry span https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#top
Show all changes 2 commits https://github.com/modelcontextprotocol/python-sdk/pull/3629/files
6af12e0 Record JSON-RPC error responses on the client OpenTelemetry span maxisbey Oct 2, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3629/commits/6af12e0d64aaae8c41af8d3897ccd474277fc94f
b6ed5bc Merge remote-tracking branch 'origin/main' into 3174-client-span-erro… maxisbey Oct 2, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/3629/commits/b6ed5bc2dfd655b586165ac7f03b687fd8b82c76
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/3629/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
test_otel.py https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
src/mcp/shared/jsonrpc_dispatcher.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
View file https://github.com/modelcontextprotocol/python-sdk/blob/b6ed5bc2dfd655b586165ac7f03b687fd8b82c76/src/mcp/shared/jsonrpc_dispatcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3629/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
cubic-dev-aihttps://github.com/apps/cubic-dev-ai
Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#r4166175455
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
claudehttps://github.com/apps/claude
Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#r4166176804
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
tests/shared/test_otel.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
View file https://github.com/modelcontextprotocol/python-sdk/blob/b6ed5bc2dfd655b586165ac7f03b687fd8b82c76/tests/shared/test_otel.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/3629/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
claudehttps://github.com/apps/claude
Oct 2, 2026https://github.com/modelcontextprotocol/python-sdk/pull/3629/files#r4166176813
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/3629/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.