Callback when a tool starts execution.
(self, call: CTPToolCall)
| 441 | self._cancelled = True |
| 442 | |
| 443 | async def _on_tool_start(self, call: CTPToolCall) -> None: |
| 444 | """Callback when a tool starts execution.""" |
| 445 | meta = self._call_metadata.get(call.id) |
| 446 | display_name = meta.display_name if meta else call.tool |
| 447 | arguments = meta.arguments if meta else call.arguments |
| 448 | |
| 449 | # For dynamic tools, enhance the display |
| 450 | if call.tool == DYNAMIC_TOOL_PROXY_NAME and "tool_name" in arguments: |
| 451 | actual_tool = arguments["tool_name"] |
| 452 | display_name = f"{actual_tool}" # Just show the actual tool name |
| 453 | # Show only the tool's arguments, not tool_name |
| 454 | arguments = {k: v for k, v in arguments.items() if k != "tool_name"} |
| 455 | |
| 456 | logger.info(f"Executing tool: {call.tool} with args: {arguments}") |
| 457 | await self.ui_manager.start_tool_execution(display_name, arguments) |
| 458 | |
| 459 | async def _on_tool_result(self, result: CTPToolResult) -> None: |
| 460 | """Callback when a tool completes. |