Pass tool_name/prompt_name to client_span in proxy providers

Ensures proxied tool/prompt spans get gen_ai.tool.name and
gen_ai.prompt.name attributes, matching direct call spans.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
William Easton 2026-04-14 11:55:52 -05:00
commit 48c196a343

View file

@ -119,7 +119,10 @@ class ProxyTool(Tool):
"""Executes the tool by making a call through the client."""
backend_name = self._backend_name or self.name
with client_span(
f"tools/call {backend_name}", "tools/call", backend_name
f"tools/call {backend_name}",
"tools/call",
backend_name,
tool_name=backend_name,
) as span:
span.set_attribute("fastmcp.provider.type", "ProxyProvider")
client = await self._get_client()
@ -450,7 +453,10 @@ class ProxyPrompt(Prompt):
"""Render the prompt by making a call through the client."""
backend_name = self._backend_name or self.name
with client_span(
f"prompts/get {backend_name}", "prompts/get", backend_name
f"prompts/get {backend_name}",
"prompts/get",
backend_name,
prompt_name=backend_name,
) as span:
span.set_attribute("fastmcp.provider.type", "ProxyProvider")
client = await self._get_client()