Skip to content

feat(telemetry): record tool call arguments in logfire spans - #368

Merged
Million-mo merged 1 commit into
mainfrom
feat/tool-call-telemetry-args
Aug 12, 2026
Merged

feat(telemetry): record tool call arguments in logfire spans#368
Million-mo merged 1 commit into
mainfrom
feat/tool-call-telemetry-args

Conversation

@Million-mo

Copy link
Copy Markdown
Collaborator

Summary

Tool call arguments were missing from telemetry: the only instrumentation on the tool execution path recorded the tool_name but not the parameters passed to the tool. This PR records the full args dict in logfire spans so every tool invocation exports its parameters.

Changes

  • ToolInterceptCapability.wrap_tool_execute() — opens a tool.call logfire span carrying tool_name, tool_call_id, and the validated args dict. This is the unified interception layer for all tool sources (direct, MCP, ACP), so arguments are captured regardless of how the tool was registered.
  • ToolDisplayCapability.wrap_tool_execute() — includes the same attributes on its existing instrumentation span (rich/diff display path).
  • Regression test — asserts the span carries tool_name, tool_call_id, and the full args dict.
  • Changelog entrychangelog/unreleased/2026-08-11-tool-call-telemetry-args.md.

Verification

  • 32 tests pass in the affected test files (incl. new regression test)
  • ruff check + ruff format clean
  • mypy --strict clean on changed source files

Notes

Args are written as a single span attribute (JSON-serialized by logfire). If per-argument structured attributes are desired for querying, that can be a follow-up.

Add the tool call arguments (args dict) to observability spans so
telemetry captures what parameters each tool was invoked with.

- ToolInterceptCapability.wrap_tool_execute opens a 'tool.call' span
  with tool_name, tool_call_id, and the validated args dict — the
  unified interception layer for all tool sources (direct, MCP, ACP).
- ToolDisplayCapability.wrap_tool_execute includes the same attributes
  on its existing instrumentation span.
- Add regression test asserting the span carries tool_name, tool_call_id,
  and the full args dict.

Previously the only tool instrumentation recorded the tool name without
its parameters, leaving tool call arguments missing from telemetry.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@Million-mo
Million-mo merged commit 092c734 into main Aug 12, 2026
12 of 14 checks passed
@Million-mo
Million-mo deleted the feat/tool-call-telemetry-args branch August 12, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant