Class: ToolCallDecorator

Inherits:
EventDecorator show all
Defined in:
app/decorators/tool_call_decorator.rb

Overview

Decorates tool_call events for display in the TUI. Hidden in basic mode — tool activity is represented by the aggregated tool counter instead. Verbose mode returns tool name and a formatted preview of the input arguments. Debug mode shows full untruncated input as pretty-printed JSON with tool_use_id.

Constant Summary

Constants inherited from EventDecorator

EventDecorator::ERROR_ICON, EventDecorator::RETURN_ARROW, EventDecorator::TOOL_ICON

Instance Method Summary collapse

Methods inherited from EventDecorator

for, #render

Instance Method Details

#render_basicnil

Returns tool calls are hidden in basic mode.

Returns:

  • (nil)

    tool calls are hidden in basic mode



10
11
12
# File 'app/decorators/tool_call_decorator.rb', line 10

def render_basic
  nil
end

#render_debugHash

Returns full tool call data with untruncated input and tool_use_id ‘:tool_call, tool: String, input: String, tool_use_id: String|nil, timestamp: Integer|nil`.

Returns:

  • (Hash)

    full tool call data with untruncated input and tool_use_id ‘:tool_call, tool: String, input: String, tool_use_id: String|nil, timestamp: Integer|nil`



22
23
24
25
26
27
28
29
30
# File 'app/decorators/tool_call_decorator.rb', line 22

def render_debug
  {
    role: :tool_call,
    tool: payload["tool_name"],
    input: JSON.pretty_generate(payload["tool_input"] || {}),
    tool_use_id: payload["tool_use_id"],
    timestamp: timestamp
  }
end

#render_verboseHash

Returns structured tool call data ‘:tool_call, tool: String, input: String, timestamp: Integer|nil`.

Returns:

  • (Hash)

    structured tool call data ‘:tool_call, tool: String, input: String, timestamp: Integer|nil`



16
17
18
# File 'app/decorators/tool_call_decorator.rb', line 16

def render_verbose
  {role: :tool_call, tool: payload["tool_name"], input: format_input, timestamp: timestamp}
end