| 1 | ### code_execution_tool |
| 2 | Run terminal, Python, or Node.js commands. |
| 3 | |
| 4 | Arguments in `tool_args`: |
| 5 | - `runtime`: `terminal`, `python`, `nodejs`, or `output` |
| 6 | - `code`: command or script code |
| 7 | - `session`: terminal session id; default `0` |
| 8 | - `reset`: kill a session before running; `true` or `false` |
| 9 | |
| 10 | Rules: |
| 11 | - Put the command or script in `code`. |
| 12 | - Use `runtime=output` to poll running work. |
| 13 | - Use `input` for interactive terminal prompts. |
| 14 | - If a session is stuck, call this tool again with the same `session` and `reset=true`. |
| 15 | - Do not claim success from timeout output or a still-running command. |
| 16 | - When counting files, prefer `find` over `ls` so hidden files and type filters are handled. |
| 17 | |
| 18 | Examples: |
| 19 | |
| 20 | `{"tool_name":"code_execution_tool","tool_args":{"runtime":"terminal","session":0,"reset":false,"code":"ls -1 /tmp | wc -l"}}` |
| 21 | |
| 22 | `{"tool_name":"code_execution_tool","tool_args":{"runtime":"python","session":0,"reset":false,"code":"import os\nprint(os.getcwd())"}}` |
| 23 | |
| 24 | `{"tool_name":"code_execution_tool","tool_args":{"runtime":"output","session":0}}` |