Ollama Tool Definitions Are Not Free: The Measured Prompt-Token Cost of Every Tool You Register
You register twelve tools on a local agent, send a six-word message, and prompt_eval_count comes back at 764 instead of 18. Nothing is wrong: the definitions you sent are part of the prompt, and on a 4k default context that registry has already spent 746 of your 4096 tokens before the conversation starts — and it re-pays that cost on every turn. This article measures the cost instead of estimating it. One model, one fixed message, one local server, tool sets of 0, 1, 3, 6 and 12 definitions in a deliberately terse form, and sets of 1, 3 and 6 in a deliberately verbose form, three repeats per cell, with the raw request and response records published next to the script. ...