Repository navigation
Python: Add MCP server identity to tool execution spans - #9882
kshitijchawla wants to merge 4 commits 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>
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 |
|
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”),
|
2 similar comments
|
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”),
|
|
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”),
|
|
kshitijchawla Thanks for the contribution. This is a non-trivial telemetry and privacy-contract change, and the PR body confirms that no maintainer agreement or applicable exception exists. Please link an agreed issue that establishes the attribute and URL-path policy before implementation review resumes. Approval remains blocked until that direction is established. |
|
kshitijchawla Thanks for the contribution. Please open a microsoft/agent-framework issue before we continue this PR. The issue should explain why the proposed span attributes use |
The MCP server identity change adds _mcp_server_name to MCP function additional_properties, so the exact-match assertion in test_plain_mcp_tool_remains_unlabeled now expects it. Authored-by: GitHub Copilot for VS Code Model: Claude Sonnet 5.5
…sitive data is enabled
|
Eduard van Valkenburg (@eavanvalkenburg) Thanks for the review. I opened #10297 to cover the design: the attribute names against the existing I have paused feature work on this PR until there is agreement on that issue. I did push two small fixes so the PR is not left red:
The CLA will be signed separately. Please let me know which direction on #10297 you prefer, and I will adjust this PR to match. |

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.