When an Agent loads thousands of tools or MCP servers at the same time, the context explodes and every request consumes a large number of Tokens. The best solution is to load tools on demand to reduce Token consumption. Proxy Tool was created to solve exactly this problem: the Agent only needs one Proxy Tool, which loads other tools on demand, invoking them through the Proxy Tool and thus greatly reducing context consumption.
How It Works
Proxy Tool provides two Actions:
- load: loads the tool’s description and the structure of its input and output parameters
- call: executes a specific tool by its name
Proxy Tool supports both Hawa Code built-in tools and MCP extension tools.
Load
Hawa Code uses load to load the tool’s description. Note that it does not use JSON schema — the TypeScript format saves more Tokens.
# Read |
Call
Invokes the proxied tool by its name and parameters.
"input": { |
Prompt Cache
Models support a Prompt Cache feature: as long as the prefix of the current request remains unchanged, the KV Cache can be reused, and subsequent requests can skip recomputing the prefix.
The Anthropic Claude prefix format is as follows:
[Tool Definitions] + [System Prompt] + [Conversation History...] |
If the tool list changes, the entire prefix becomes invalid. However, the content loaded by Proxy Tool’s load action goes directly into the conversation history and does not affect any part of the prefix. The Prompt Cache is therefore completely unaffected.
Hawa Code load mode maximizes Token reduction, which causes the prefix to change.
Proxy Tool vs Code Mode
Both Hawa Code Proxy Tool and Code Mode support on-demand tool loading and can handle tens of thousands of tools. The two are complementary in usage scenarios.
- Proxy Tool performs single tool calls and cannot cascade multiple tool calls.
- Code Mode focuses on cascading calls across multiple tools, where each tool is an API — you orchestrate tool calls just like writing code.
Hawa Code mainly provides Proxy Tool and Code Mode, and these two tools alone can accomplish everything.