Skip to content
Get an API key

Tools

View as Markdown

Noduma passes tools and tool_choice to the engine of the PC that answers, llama.cpp's server, and relays the calls the model makes. Your program runs the tool and sends its result back. Whether a model calls tools well depends on the model; Qwen3 Coder 30B-A3B and gpt-oss 20B were chosen for the catalog with tool calls in mind.

  1. Send tools, an array of function tools in OpenAI's form ({"type": "function", "function": {"name", "description", "parameters"}}). Anything else in tools than an array is refused with 400 invalid_request.
  2. The answer has finish_reason: "tool_calls" and message.tool_calls, each with an id, type: "function" and function.name and function.arguments (a JSON string). content is null when the answer is only calls.
  3. Run each tool. Send the whole conversation again: the assistant message with its tool_calls, then one tool message per call, with its tool_call_id and the result as content.
{
"model": "qwen3-coder-30b-a3b-instruct-q4_k_m",
"tools": [{"type": "function", "function": {"name": "get_weather", "parameters": {"type": "object", "properties": {"city": {"type": "string"}}}}}],
"messages": [
{"role": "user", "content": "What is the weather in Madrid?"},
{"role": "assistant", "content": null, "tool_calls": [
{"id": "call_1", "type": "function", "function": {"name": "get_weather", "arguments": "{\"city\": \"Madrid\"}"}}
]},
{"role": "tool", "tool_call_id": "call_1", "content": "{\"temperature_c\": 14, \"sky\": \"clear\"}"}
]
}

When streaming, the calls arrive in one chunk with delta.tool_calls near the end. See Streaming.

Tool definitions, calls and results are part of the request and the answer: their bytes are measured and charged like text. See Credits.

A tool call is text the model wrote on someone's PC. Check its arguments before you act on them, as you would any input from outside your program. noduma agent asks before it writes a file or runs a command for this reason; see chat and agent.