normalize_tool_call

Function normalize_tool_call 

Source
pub fn normalize_tool_call(
    name: String,
    arguments: Value,
    provider_call_id: Option<String>,
) -> ToolCallPayload
👎Deprecated since 0.3.0: Use ToolMapper::normalize_call instead. See function docs for migration path.
Expand description

Normalize raw tool call data into a typed ToolCallPayload variant

§Deprecation Notice

This function is deprecated. Use provider-specific ToolMapper::normalize_call instead.

§Why deprecated?

This function contains provider-specific logic that violates architecture principles:

  • Provider details leak into a provider-agnostic layer
  • Not scalable: adding providers requires modifying this function
  • Responsibility inversion: provider-specific logic should be in provider implementations

§Migration path

Instead of using this function directly, use the ToolMapper trait:

ⓘ
use agtrace_providers::ProviderAdapter;

let adapter = ProviderAdapter::claude();
let payload = adapter.mapper.normalize_call("Read", args, Some("call_123"));

Each provider implements ToolMapper::normalize_call with provider-specific logic:

  • ClaudeToolMapper handles Claude Code tools
  • CodexToolMapper handles Codex tools
  • GeminiToolMapper handles Gemini tools

§Legacy behavior

This function provides generic normalization for common tool patterns. It does NOT parse provider-specific details like MCP server/tool names. For full normalization, use provider-specific mappers.