Tool Schemas

2026-01-12 tool_use_result ultrathink

Bash

{ "stdout": "hello", "stderr": "", "interrupted": false, "isImage": false }

Background mode adds:

"backgroundTaskId": "833aa6"

BashOutput

{ "shellId": "833aa6", "command": "sleep 2 && echo done", "status": "completed", "exitCode": 0, "stdout": "done", "stderr": "", "stdoutLines": 1, "stderrLines": 1, "timestamp": "..." }

Status can be "completed" or "running".

Read

{ "type": "text", "file": { "filePath": "...", "content": "...", "numLines": 10, "startLine": 1, "totalLines": 135 } }

Write

{ "type": "create", "filePath": "...", "content": "...", "structuredPatch": [], "originalFile": null }

Edit

{ "filePath": "...", "oldString": "...", "newString": "...", "originalFile": "...", "structuredPatch": [ { "oldStart": 1, "oldLines": 2, "newStart": 1, "newLines": 3, "lines": ["+new", " unchanged"] } ], "userModified": false, "replaceAll": false }

Includes unified diff in structuredPatch.

Glob

{ "filenames": [ "/path/to/file1.md", "/path/to/file2.md" ], "durationMs": 455, "numFiles": 4, "truncated": false }

Grep

{ "mode": "content", "numFiles": 0, "filenames": [], "content": "file.ts:42:matching line", "numLines": 1, "appliedLimit": 100 }

Mode can be "content", "files_with_matches", or "count".

WebFetch

{ "bytes": 513, "code": 200, "codeText": "OK", "result": "AI-processed content...", "durationMs": 1468, "url": "https://..." }

WebSearch

{ "query": "search query", "results": [ { "tool_use_id": "...", "content": [ { "title": "...", "url": "..." } ] } ], "durationSeconds": 21.4 }

TodoWrite

{ "oldTodos": [ { "content": "Task A", "status": "pending", "activeForm": "..." } ], "newTodos": [ { "content": "Task A", "status": "completed", "activeForm": "..." } ] }

Shows before/after state. Deletion = item missing from newTodos.

Task (Sub-Agents)

{ "status": "completed", "prompt": "...", "agentId": "4b38c8b3", "content": [ { "type": "text", "text": "Agent response..." } ], "totalDurationMs": 6457, "totalTokens": 16151, "totalToolUseCount": 2, "usage": {...} }

Sub-agent notes

  • parent_tool_use_id links sub-agent messages to parent Task
  • Sub-agents canNOT spawn their own sub-agents (max depth = 1)
  • Available agent types: general-purpose, Explore, Plan, claude-code-guide, statusline-setup

Not Captured

These require special conditions:

  • KillShell — needs active background process
  • NotebookEdit — needs .ipynb file
  • AskUserQuestion — blocked in headless
  • Skill/SlashCommand — needs plugin setup
  • EnterPlanMode/ExitPlanMode — mode transitions