Skip to content

Expose telemetry_attributes in toolbox-adk Toolset/Tool wrappers #718

Description

@AjmeraParth132

Prerequisites

What are you trying to do that currently feels hard or impossible?

toolbox-core supports TelemetryAttributes and sends client metadata such as model, user ID, and agent ID through MCP _meta for extended telemetry / SQLCommenter. This was added in #632 / #634.

However, toolbox-adk does not currently expose a way to pass those telemetry attributes through ToolboxToolset or ToolboxTool. ADK users can load and invoke Toolbox tools, but cannot attach per-invocation telemetry metadata from ADK context, such as the current ToolContext, session user, agent ID, or model.

This means ADK applications cannot use the core telemetry attribute flow without bypassing the ADK wrapper.

Suggested Solution(s)

Add a telemetry_attributes argument to toolbox_adk.ToolboxToolset and toolbox_adk.ToolboxTool.

Support:

  • A static TelemetryAttributes instance.
  • A sync or async zero-argument callback.
  • A sync or async one-argument callback receiving ADK ToolContext.

This should follow the existing ADK callback pattern from #579, where one-argument callbacks receive ToolContext.

At invocation time, resolve telemetry attributes per call and apply them with core_tool.add_telemetry_attributes(...).

Important: context-derived telemetry should not mutate the shared wrapped core tool, otherwise user/agent metadata from one invocation can leak into later invocations

Alternatives Considered

No response

Additional Details

This extends the core telemetry implementation from #634 into the ADK integration only. It should preserve existing ADK auth behavior and should include tests for:

  • Passing telemetry attributes from ToolboxToolset into wrapped tools.
  • Resolving dynamic telemetry attributes per invocation from ToolContext.
  • Ensuring the base core tool is not mutated across calls.
  • Ensuring user identity token cleanup still happens if telemetry resolution fails.

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions