In this recipe, you will see how the AI calls engineering tools (@tool_call) to fix tests.
The User Defines the Goal
Start /coder mode with a clear instruction about what needs to be fixed./coder fix the failing tests
The AI Investigates (ReAct Loop)
The AI analyzes the request and calls the plugin to run the tests and identify the errors:<reasoning>
Run go test to see errors.
</reasoning>
<tool_call name="@coder" args="{"cmd":"test","args":{"dir":"."}}"/>
ChatCLI Executes
The command result is returned to the AI. ChatCLI acts as an intermediary, executing the requested command and capturing the output.
The AI Continues (Reading)
Based on the errors found, the AI requests to read the problematic file:<reasoning>
Read the file with the error.
</reasoning>
<tool_call name="@coder" args="{"cmd":"read","args":{"file":"main.go"}}"/>
Applying the Fix (Patch)
After analyzing the code, the AI generates and applies the necessary patch:<reasoning>
Apply patch to fix logic.
</reasoning>
<tool_call name="@coder" args="{"cmd":"patch","args":{"file":"main.go","encoding":"base64","search":"base64_old","replace":"base64_new"}}"/>
This entire flow happens autonomously within /coder mode. The AI executes a ReAct loop (Reason + Act) where each step informs the next, until all tests pass.