ask-uses-text-based-tool-protocol

IN premise

`ask.py` implements tool use by parsing JSON lines with a `"tool"` key from LLM text output, not Claude's native tool-use API, because it invokes `claude -p` (pipe mode) which doesn't support function calling.

Summary

The script handles tool calls by reading structured JSON from the model's plain text output rather than using Claude's built-in function-calling mechanism. This matters because it means tool definitions, argument validation, and result handling all depend on the model reliably producing correctly formatted JSON text, making the system more fragile than native tool use but also simpler to implement over a CLI pipe.

Details

Sourceentries/2026/04/29/reasons_lib-ask.md