Repository navigation
Python: Add MCP server identity to tool execution spans - #9882
kshitijchawla wants to merge 1 commit into
Conversation
Preserve the configured MCP server name and filtered HTTP URL on generated tool functions and execution spans. Add focused identity regression tests. Authored-by: GitHub Copilot for VS Code Model: GPT-6.1 Sol Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
kshitijchawla please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
Tool-span url.full exposes path-embedded tokens even when sensitive-data capture is disabled, violating the default telemetry privacy policy.
1 open issue
What changed in this PR
Adds MCP server attribution to Python tool-execution telemetry so consumers can identify the configured server behind each tool call.
Changes:
- Carries server names and filtered HTTP(S) URLs through generated function metadata.
- Adds
microsoft.tool.server.nameandurl.fullspan attributes when available. - Adds focused tests for URL filtering, server identity, and attribute omission.
| File | Description |
|---|---|
python/packages/core/tests/core/test_mcp_observability.py |
Tests URL filtering and server identity attributes. |
python/packages/core/agent_framework/observability.py |
Defines and emits server identity span attributes. |
python/packages/core/agent_framework/_mcp.py |
Filters server URLs and attaches identity metadata during discovery. |
Review effort: Balanced
| if isinstance(server_url, str) and server_url: | ||
| attributes[OtelAttr.URL_FULL] = server_url |

Motivation & Context
Identify the configured MCP server behind tool execution spans so telemetry consumers can attribute tool activity to its server.
Description & Review Guide
microsoft.tool.server.nameandurl.fullto tool span attributes. Add focused identity and URL-filtering tests.Related Issue
No agreed issue is linked. The submitter explicitly requested publishing this draft without an issue link. Maintainer agreement has not been established; this is not a trivial-change exception.
AI Assistance
AI assistance details: Copilot assisted with code inspection, publication preparation, and this PR description. Runtime validation remains outstanding.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — workflows keep the label and title prefix in sync automatically.