AgentRegistry.get_mcp_toolset() reads the wrong field for gcp.mcp.server.destination.id — breaks Agent Platform Topology view
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- python
调研方向
从 google/adk/integrations/agent_registry/agent_registry.py 中的 AgentRegistry.get_mcp_toolset() 开始,跟踪 AgentRegistrySingleMcpToolset.get_tools() 如何设置目标元数据。将响应中的 mcpServerId 与 attributes["agentregistry.googleapis.com/system/RuntimeReference"]["uri"] 进行比较,然后验证 execute_tool spans 是否携带 Agent Platform Topology matcher 所需的资源名称 URI。
由索引模型根据 Issue 内容生成。
描述
AgentRegistry.get_mcp_toolset() populates the gcp.mcp.server.destination.id span attribute (used to associate an execute_tool span with its destination MCP server for App Hub / Agent Platform Topology matching) from the Agent Registry API's mcpServerId field — a urn:mcp:... value.
The Agent Platform Topology view's connection matcher expects the App Hub resource-name URI form instead (//agentregistry.googleapis.com/projects/<number>/locations/<region>/services/<name>), which is present, unused, in the very same API response under attributes["agentregistry.googleapis.com/system/RuntimeReference"]["uri"].
As a result, no topology connection is ever drawn for an MCP server reached through AgentRegistry/AgentRegistrySingleMcpToolset, regardless of correct registration, functional type, or App Hub configuration — the span's destination identifier never matches the App Hub inventory's own identifier form for that same resource.
Steps to Reproduce:
- Register an MCP server with Agent Registry and build an
McpToolsetfor it viaAgentRegistry.get_mcp_toolset(mcp_server_name). - Have an ADK agent call a tool from that toolset, with tracing enabled (
--otel_to_cloud, OTLP export totelemetry.googleapis.com). - Inspect the resulting
execute_toolspan'sgcp.mcp.server.destination.idattribute — it is the Agent Registry API'smcpServerIdvalue, aurn:mcp:projects-<number>:projects:<number>:locations:<region>:agentregistry:services:<name>string. - Separately,
GETthe same MCP server resource from the Agent Registry API directly (.../v1/projects/<number>/locations/<region>/mcpServers/<id>) and comparemcpServerIdagainstattributes["agentregistry.googleapis.com/system/RuntimeReference"]["uri"]in the same response — the two differ in form. - Open the Agent Platform console's Topology view for the calling agent — no connection is drawn to the MCP server, even with App Hub discovery, functional types, and registration otherwise correct.
Expected Behavior:
gcp.mcp.server.destination.id should be set to the App Hub resource-name URI (RuntimeReference.uri), so the Agent Platform Topology view's connection matcher can resolve it against its own discovered-resource inventory and draw the connection.
Observed Behavior:
The attribute is set to mcpServerId (a urn:mcp:... value) instead, which never matches App Hub's inventory. The Topology view draws no connection to the MCP server.
Confirmed by hand-crafted OpenTelemetry traces sent through the same OTLP-to-telemetry.googleapis.com export path ADK's own agents use: a trace with the real urn:mcp:... value produces no connection; the identical trace with only that attribute rewritten to the RuntimeReference.uri form produces one immediately. Confirmed independently on two separate, previously-untested MCP servers, changing only that one attribute.
Environment Details:
- ADK Library Version (
pip show google-adk): reproduced on2.7.0and2.9.2(latest at time of writing) — identical behavior in both - Desktop OS: N/A — server-side library behavior, not OS-dependent
- Python Version (
python -V):3.11(deployment container); also reproduced against the library installed under Python 3.14 in an isolated verification environment
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A — bug is in the Agent Registry / tracing integration, independent of model
Regression:
Not established — reproduces identically on both 2.7.0 and the current latest (2.9.2), so not a recent regression as far as tested.
Additional Context:
The Agent Registry API returns both identifiers in the same object, which is what makes this a precise, one-field fix rather than a missing-data problem:
{
"mcpServerId": "urn:mcp:projects-<number>:projects:<number>:locations:<region>:agentregistry:services:<name>",
"attributes": {
"agentregistry.googleapis.com/system/RuntimeReference": {
"uri": "//agentregistry.googleapis.com/projects/<number>/locations/<region>/services/<name>"
}
}
}
Relevant source (unchanged between 2.7.0 and 2.9.2, only line numbers shift):
google/adk/integrations/agent_registry/agent_registry.py,AgentRegistry.get_mcp_toolset(): readsmcp_server_id = server_details.get("mcpServerId")and passes it verbatim asdestination_resource_idintoAgentRegistrySingleMcpToolset.- Same file,
AgentRegistrySingleMcpToolset.get_tools(): stampstool.custom_metadata["gcp.mcp.server.destination.id"] = self.destination_resource_idon every tool. google/adk/telemetry/tracing.py,trace_tool_call(): copies that value verbatim onto theexecute_toolspan, with an in-source comment: "Used to associate a span with a destination resource for AppHub."
Suggested fix: source destination_resource_id from server_details["attributes"]["agentregistry.googleapis.com/system/RuntimeReference"]["uri"] instead of (or in preference to) mcpServerId.
How often has this issue occurred?:
- Always (100%)
- 主要语言
- Python
- 星标
- 21.6k
- 派生
- 4k
- 平均合并
- 13 小时 49 分钟
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
google/adk-python 的其他 Issue
-
mcp
难度 2/5 1-3 小时 新手友好度 75/100
google/adk-python#7217 · 2 条评论 · 已指派 1 人 ·
-
tools
难度 2/5 1-3 小时 新手友好度 78/100
google/adk-python#7206 · 1 条评论 · 已指派 1 人 ·
-
tools
难度 2/5 1-3 小时 新手友好度 86/100
google/adk-python#7205 · 1 条评论 · 已指派 1 人 ·
-
eval request clarification
难度 1/5 1-3 小时 新手友好度 86/100
google/adk-python#7146 · 2 条评论 · 已指派 1 人 ·
-
mcp
难度 2/5 1-3 小时 新手友好度 88/100
google/adk-python#7144 · 1 条评论 · 已指派 1 人 ·
查看 google/adk-python 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 88/100
use-agent-os/agent-os#3314 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 62/100
AiursoftWeb/AnduinOS-2#19 ·