Expand description
Classifies what produced a tool_result so the proxy never lossy-compresses
a file/source-code read the model still needs (e.g. mid-refactor).
The request body only carries the tool result plus an id linking it to the
originating tool call. We resolve that id → tool name from the assistant’s
tool_use / tool_calls / function_call items, then map the name to a
ToolResultKind. A content heuristic (looks_like_source_code) is the
fallback for unknown/custom tools so a file read through a non-standard tool
is still protected.
Enums§
- Tool
Result Kind - What kind of tool produced a
tool_result.
Functions§
- anthropic_
tool_ commands tool_use_id → commandfor the Anthropictool_useblocks whose input names a shell command (Bash {command}).- anthropic_
tool_ names - Builds a
tool_use_id → tool_namemap from Anthropicmessages. - classify_
tool_ name - Maps a tool name (from any agent) to a
ToolResultKind. - gemini_
tool_ commands (contents index, parts index) → commandfor the GeminifunctionResponseparts whosefunctionCallnames a shell command in itsargs(Gemini CLI’srun_shell_command {command}). A response answers the call with itsidwhen it carries one; without anid, Gemini pairs calls and responses by name in order, so it answers the first unanswered call of its name. A response that matches no call gets no command — and is compressed like any other result (with its re-read hint).- looks_
like_ source_ code - Heuristic fallback: does this text look like source code (vs command output)?
- openai_
tool_ commands tool_call_id → commandfor the Chat Completionstool_calls[]whosefunction.argumentsname a shell command.- openai_
tool_ names - Builds a
tool_call_id → function_namemap from OpenAI Chat Completionsmessages(assistanttool_calls[]). - responses_
tool_ commands call_id → commandfor the Responsesfunction_callitems whoseargumentsname a shell command, andlocal_shell_callitems (action.command).- responses_
tool_ names - Builds a
call_id → namemap from OpenAI Responsesinputitems (type:"function_call"). - should_
protect - Whether a
tool_resultwith the given resolved kind and content must be preserved intact (never lossy-compressed) by the proxy.