René's URL Explorer Experiment


Title: Add GenAI semconv attributes to native OTel spans by etserend · Pull Request #2854 · modelcontextprotocol/python-sdk · GitHub

Open Graph Title: Add GenAI semconv attributes to native OTel spans by etserend · Pull Request #2854 · modelcontextprotocol/python-sdk

X Title: Add GenAI semconv attributes to native OTel spans by etserend · Pull Request #2854 · modelcontextprotocol/python-sdk

Description: The existing otel_middleware and client-side spans only emitted mcp.method.name and jsonrpc.request.id. This enriches them with attributes defined in the OTel GenAI MCP semantic conventions: gen_ai.operation.name — operation type derived from the method (execute_tool for tools/call, list_tools for tools/list, read_resource for resources/read, get_prompt for prompts/get, etc.) gen_ai.tool.name — tool or prompt name from params.name when present mcp.resource.uri — resource URI from params.uri or params.ref.uri rpc.system = "mcp" — standard RPC system attribute Motivation and Context The SDK already ships otel_middleware in src/mcp/server/runner.py producing SpanKind.SERVER spans with W3C trace context propagation. Aligning the native span attributes with the GenAI semconv spec means every MCP-based framework and every distribution gets conformant telemetry without independently re-implementing span plumbing. How Has This Been Tested? Adds three tests to tests/shared/test_otel.py: test_client_and_server_spans — tools/call: asserts gen_ai.operation.name=execute_tool, gen_ai.tool.name, rpc.system, and trace context propagation (both spans share the same trace_id) test_list_tools_spans — tools/list: asserts gen_ai.operation.name=list_tools and absence of gen_ai.tool.name (no specific tool targeted on a list call) test_resource_read_spans — resources/read: asserts gen_ai.operation.name=read_resource and mcp.resource.uri Types of changes New feature (non-breaking change which adds functionality) Checklist I have read the MCP Documentation My code follows the repository's style guidelines New and existing tests pass locally I have added appropriate error handling I have added or updated documentation as needed Additional context

Open Graph Description: The existing otel_middleware and client-side spans only emitted mcp.method.name and jsonrpc.request.id. This enriches them with attributes defined in the OTel GenAI MCP semantic conventions: gen_a...

X Description: The existing otel_middleware and client-side spans only emitted mcp.method.name and jsonrpc.request.id. This enriches them with attributes defined in the OTel GenAI MCP semantic conventions: gen_a...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.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:ddc47e1f-f4b4-cea2-d33e-71a211de8a85
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id86B4:E6B97:117135E:180392A:6B05698C
html-safe-noncef50181b0a13b6d24b4888038f9e02bc046a84db621800660c457c06e5112ecd3
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkI0OkU2Qjk3OjExNzEzNUU6MTgwMzkyQTo2QjA1Njk4QyIsInZpc2l0b3JfaWQiOiI0NzkyMDQzODk0Njg5MDY1MzU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac8c828741533689844dea950e7040e4c94b03dbd4e71c57962985e9e87cd0794e
hovercard-subject-tagpull_request:3857219830
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/2854/files
twitter:imagehttps://avatars.githubusercontent.com/u/105012329?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/105012329?s=400&v=4
og:image:altThe existing otel_middleware and client-side spans only emitted mcp.method.name and jsonrpc.request.id. This enriches them with attributes defined in the OTel GenAI MCP semantic conventions: gen_a...
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/2854/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmodelcontextprotocol%2Fpython-sdk%2Fpull%2F2854%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%2F2854%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/2854/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files
Reloadhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/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
etserendhttps://github.com/etserend
modelcontextprotocol:mainhttps://github.com/modelcontextprotocol/python-sdk/tree/main
etserend:enrich-otel-spans-genai-semconvhttps://github.com/etserend/python-sdk/tree/enrich-otel-spans-genai-semconv
Conversation 5 https://github.com/modelcontextprotocol/python-sdk/pull/2854
Commits 4 https://github.com/modelcontextprotocol/python-sdk/pull/2854/commits
Checks 29 https://github.com/modelcontextprotocol/python-sdk/pull/2854/checks
Files changed https://github.com/modelcontextprotocol/python-sdk/pull/2854/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files
Add GenAI semconv attributes to native OTel spans https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#top
Show all changes 4 commits https://github.com/modelcontextprotocol/python-sdk/pull/2854/files
fb175a4 Add GenAI semconv attributes to native OTel spans etserend Jun 12, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2854/commits/fb175a46d0dced5f2bbcd945b8ffd759c263fb88
ecd55be Fix pyright type errors and coverage gaps in OTel span attributes etserend Jun 12, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2854/commits/ecd55beedd6e96e94119e2c9acb15c203baca122
21381fc Address review: restrict gen_ai.operation.name to tools/call per spec… etserend Jun 13, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2854/commits/21381fc0e56866c40bce044176ace5f3538bf8e3
5744777 Fix ruff formatting: add blank line before build_span_attributes etserend Jun 13, 2026 https://github.com/modelcontextprotocol/python-sdk/pull/2854/commits/57447771ca9b559c77ec5030ca3c09f280021381
Clear filters https://github.com/modelcontextprotocol/python-sdk/pull/2854/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files
runner.py https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
_otel.py https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-f7b9208e58bf90e0bfe4ecf1f810dfdb14524bbd475f9f8e01c3df04355bd598
jsonrpc_dispatcher.py https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
test_otel.py https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
src/mcp/server/runner.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
View file https://github.com/etserend/python-sdk/blob/57447771ca9b559c77ec5030ca3c09f280021381/src/mcp/server/runner.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2854/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-7a9c3e13faa5730f5a8a60062e9d200513c0baeada63e3cc24b37fe68e086e90
src/mcp/shared/_otel.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-f7b9208e58bf90e0bfe4ecf1f810dfdb14524bbd475f9f8e01c3df04355bd598
View file https://github.com/etserend/python-sdk/blob/57447771ca9b559c77ec5030ca3c09f280021381/src/mcp/shared/_otel.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2854/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-f7b9208e58bf90e0bfe4ecf1f810dfdb14524bbd475f9f8e01c3df04355bd598
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-f7b9208e58bf90e0bfe4ecf1f810dfdb14524bbd475f9f8e01c3df04355bd598
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-f7b9208e58bf90e0bfe4ecf1f810dfdb14524bbd475f9f8e01c3df04355bd598
src/mcp/shared/jsonrpc_dispatcher.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
View file https://github.com/etserend/python-sdk/blob/57447771ca9b559c77ec5030ca3c09f280021381/src/mcp/shared/jsonrpc_dispatcher.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2854/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-3d8fb73fa8b126691302c15bb63bbc44a3a0e9338a17f14b3b4ea1d97bb10c2c
tests/shared/test_otel.pyhttps://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
View file https://github.com/etserend/python-sdk/blob/57447771ca9b559c77ec5030ca3c09f280021381/tests/shared/test_otel.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/modelcontextprotocol/python-sdk/pull/2854/{{ revealButtonHref }}
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
https://github.com/modelcontextprotocol/python-sdk/pull/2854/files#diff-84f003b56f0cb53b4aa8d9c9b77caceba5fdebd6874448f02410dffb0815cbaa
Please reload this pagehttps://github.com/modelcontextprotocol/python-sdk/pull/2854/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.