trading_agent.terminal.tool_describer
¶
Describes tool calls in plain words: what one is doing now, and a summary of several once done.
It is a port of the web page's toolDescriber.ts, so the terminal and the browser use the same words.
Typical usage example:
describer = ToolDescriber() describer.activity('get_quote') # 'Fetching a quote' describer.summary([('get_quote', False), ('bash_run', True)])
ToolDescriber
¶
Words for tool calls, keyed by tool name.
activity
¶
What a running tool is doing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_name
|
str
|
The tool's name, with or without Claude Code's MCP prefix. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Such as "Fetching a quote", or "Using |
Source code in src/trading_agent/terminal/tool_describer.py
detail
¶
The most telling argument of a tool call, shortened.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arguments_text
|
str
|
The call's arguments as JSON text. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Such as "RELIANCE" or "ls -la", or an empty string when there is none. |
Source code in src/trading_agent/terminal/tool_describer.py
summary
¶
One line summing up several tool calls, as Claude Code does.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
calls
|
Sequence[tuple[str, bool]]
|
Each call's tool name and whether it failed, in order. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Such as "Fetched 2 quotes, ran a command (1 failed)". |
Source code in src/trading_agent/terminal/tool_describer.py
base_name
¶
A tool's own name without the prefix Claude Code adds to tools served over MCP.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tool_name
|
str
|
The name as the event gives it. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Such as "get_quote" for "mcp__trading_agent__get_quote". |