Skip to main content
In this recipe, you will see how the AI calls engineering tools (@tool_call) to fix tests.
1

The User Defines the Goal

Start /coder mode with a clear instruction about what needs to be fixed.
/coder fix the failing tests
2

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="{&quot;cmd&quot;:&quot;test&quot;,&quot;args&quot;:{&quot;dir&quot;:&quot;.&quot;}}"/>
3

ChatCLI Executes

The command result is returned to the AI. ChatCLI acts as an intermediary, executing the requested command and capturing the output.
4

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="{&quot;cmd&quot;:&quot;read&quot;,&quot;args&quot;:{&quot;file&quot;:&quot;main.go&quot;}}"/>
5

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="{&quot;cmd&quot;:&quot;patch&quot;,&quot;args&quot;:{&quot;file&quot;:&quot;main.go&quot;,&quot;encoding&quot;:&quot;base64&quot;,&quot;search&quot;:&quot;base64_old&quot;,&quot;replace&quot;:&quot;base64_new&quot;}}"/>
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.