Skip to content

v2: Tool.execute and MCP.callTool spans no longer carry tool.name / tool.call_id #62305

Closed

Description

@tiennv147

Description

In v2, the Tool.execute and MCP.callTool spans no longer say which tool ran. In v1 they had tool.name and tool.call_id (#22531, and #25452 for MCP and plugin tools). Since the v2 rewrite, Tool.execute in packages/core/src/tool.ts is a bare Effect.fn("Tool.execute"), and MCP.callTool in packages/core/src/mcp/index.ts has no attributes either.

In a trace backend, every tool call now looks the same: status and duration only. The only way to tell which tool a span ran is the error message, and only when the call fails (MCP tool "github-get_file_contents" on server "litellm" failed: …).

Expected: the attributes from v1, ideally also with the OTel GenAI names, so GenAI-aware backends can show the calls:

  • tool.name / gen_ai.tool.name
  • tool.call_id / gen_ai.tool.call.id
  • gen_ai.operation.name = execute_tool
  • session.id
  • for MCP: the server name, e.g. mcp.server.name

The values are already in scope there (name, context.id, context.sessionID, input.server). The tool.execute.after hook receives them too.

Related: #46856 (trace context on MCP calls). Together these two would let MCP calls show up properly inside the agent trace.

Plugins

none

OpenCode version

2.1.2 (checked the code on v2.2.5)

Steps to reproduce

  1. Set OTEL_EXPORTER_OTLP_ENDPOINT and run opencode run with a prompt that uses a few tools (built-in and MCP).
  2. Open the trace in any OTLP backend.
  3. Tool.execute / MCP.callTool spans have no tool.name or call id. On v1 they did.

Operating System

Linux (container)

Terminal

n/a (opencode run)

Activity

  1. opencodejr commented on Nov 6, 2026

    @opencodejr

    Thanks for the detailed report. I reproduced this on 2.1.2. A simulated model called the built-in read tool and then a tool on a small local MCP server, with the OTLP export going to a local collector. Both Tool.execute and MCP.callTool came back with no attributes at all.

    On the latest dev (21eaa62), Tool.execute now has gen_ai.tool.name, gen_ai.tool.call.id and session.id. The change is #60974, which isn't in a release yet (it isn't in v2.2.5). So the main problem, tool spans that don't say which tool ran, looks fixed, and the fix should be in the next release.

    Not everything you listed is there yet:

    • MCP.callTool still has only session.id: no MCP server name or tool name. The parent Tool.execute span has the namespaced tool name, e.g. echosrv_echo.
    • The older tool.name / tool.call_id keys and gen_ai.operation.name aren't set.

    If you need those, a feature request focused on them would be the best way to track it.

    The bot will close this issue in 1 day unless you reply that it still happens, e.g. on a newer release.

  2. opencodejr commented on Nov 7, 2026

    @opencodejr

    Closing this as completed, since there was no reply after a day. I reproduced it on 2.1.2: Tool.execute and MCP.callTool were exported with no attributes. On the latest dev (21eaa62), Tool.execute now has gen_ai.tool.name, gen_ai.tool.call.id and session.id, from #60974. That change isn't in a release yet, so it should ship in the next one.

    The extras you listed aren't there yet: an MCP server name or tool name on MCP.callTool, the older tool.name / tool.call_id keys, and gen_ai.operation.name. If you need them, a separate feature request would be the best way to track that. If the missing tool name or call id still happens on a newer release, please comment here or open a new issue. Thanks for the detailed report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions