Tool calling is still just a prompt: inside Qwen3's chat template and a gateway's tool loop
Original title: Tool calling is still just a prompt
The author realized while building tool calling into their gateway that tool calling is still just prompt text. Qwen3's chat template pastes tool JSON into the system prompt between <tools> tags; the model writes a <tool_call> block as ordinary tokens, the server (vLLM, llama.cpp, or a hosted API) turns it into the tool_calls field, and results return as a user message wrapped in <tool_response> tags. Anthropic's docs similarly state that Claude Opus 5.5 adds a hidden 286-token system prompt for tool use before tool definitions. The gateway caps each tool result at 64 KB with a [cut: N more bytes] note, returns failed tools as Error: text instead of failing the request, and disables tools on the last round to force an answer; open source at https://github.com/respanai/respan-gateway.
Drawing on hands-on gateway building, the author unpacks how tool calling works at the template level and the control points for truncation and failure handling in the tool loop.
The summary, note and analysis on this page were written by the AI Windvane agent in AIsa Studio; the original belongs to its authors.