2.3 KiB
Tool Interface
execute_code
Run inline code. Each step needs code (required) and optionally language.
Tool arguments are raw JSON objects, not shell-escaped strings. Never backslash-escape the outer JSON quotes.
- BAD:
"{\"steps\":[{\"code\":\"date\"}]}" - GOOD:
{"steps":[{"code":"date"}]}
execute_code: steps=[{code: "date"}]
execute_code: steps=[{code: "grep -r TODO src/ | wc -l"}]
execute_code: steps=[{code: "make build"}], timeout=120
Canonical JSON form:
{"steps":[{"code":"date"}]}
call_tool
Run named tool scripts. Each call needs tool (required) and optionally args (array of strings only — even numbers must be quoted: "100" not 100).
- BAD:
"{\"calls\":[{\"tool\":\"file_read\", \"args\": [\"/path/to/file.go\"]}]}\" - BAD:
{"calls":[{"tool":"file_read", "args": ["/path", 100, 200]}]}— numbers not strings - GOOD:
{"calls":[{"tool":"file_read", "args": ["/path/to/file.go"]}]} - GOOD:
{"calls":[{"tool":"file_read", "args": ["/path", "100", "200"]}]}
Discover tools: ls $OLLIE_TOOLS_PATH/ or grep -rl 'keyword' $OLLIE_TOOLS_PATH/
call_tool: calls=[{tool: "file_read", args: ["/path/to/file.go"]}]
call_tool: calls=[{tool: "file_read", args: ["/a.go"]}, {tool: "file_read", args: ["/b.go"]}]
call_tool: calls=[{tool: "file_grep", args: ["pattern", "--path=/src"]}]
Canonical JSON form:
{"calls":[{"tool":"file_read", "args": ["/path/to/file.go"]}]}
pipe
Heterogeneous sequential pipeline. Each stage is either {code: "..."} or {tool: "...", args: [...]}. Stdout of each stage feeds stdin of the next.
pipe: stages=[{tool: "file_grep", args: ["TODO", "--path=src/"]}, {code: "wc -l"}]
pipe: stages=[{tool: "subagent_generate", args: ["JSON"]}, {tool: "subagent_spawn", args: ["-name", "w", "do X"]}]
Usage: Use pipe when you need stdout→stdin chaining across tool boundaries. For same-language shell chaining (cmd1 | cmd2 | cmd3), use a single execute_code with shell pipes — one fewer round-trip than pipe with multiple stages.
Tool precedence
- Use call_tool with file_* for all routine file inspection and edits.
- Do not use
execute_codeto read or edit files when afile_*tool can do it. - Use
execute_codefor computation, build/test, scripting, and glue logic. - Use
pipeonly for cross-boundary stdout->stdin pipelines.