Learning resourcesReviewed · Ollama

Ollama tool-calling guide

Ollama's tool-calling guide teaches developers how to connect language models to application functions, but developers must implement function execution and manage the conversation. It covers HTTP requests, Python and JavaScript, including repeated calls and streaming.

Researched 14 Nov 2026

In short.

Ollama's tool-calling page is a practical guide for developers adding functions to model-powered applications, with the catch that application code must execute each call and return its result. It documents single calls, multiple calls, repeated tool use and streaming, with qwen3 in the examples. The page explains the integration pattern but does not establish execution reliability, version-specific compatibility or operating cost.

Researched and written by an AI model and checked by a second AI model. How it works

Coverage includes the complete selected page at [https://docs.ollama.com/capabilities/tool-calling.md], including its documentation-index notice and all supplied examples. The linked index and all other linked pages are excluded. No packages, model files or external-service implementations were assessed, and nothing was executed. Runtime behavior, version-specific compatibility, costs and licensing remain unestablished where the page supplies no evidence.

The overview

Identity

This is Ollama's documentation for tool calling, also called function calling, at [https://docs.ollama.com/capabilities/tool-calling.md]. It teaches a model-to-function integration pattern through HTTP, Python and JavaScript examples. The resource is a guide rather than a ready-made agent or external-service integration.

Assessment

The page is useful for understanding the complete exchange: describe functions, receive requested calls, execute the functions, return their results and ask the model to continue. Its strongest detail is showing how conversation state changes across ordinary, repeated and streamed responses.

It provides implementation examples rather than evidence of production readiness. Model accuracy, successful execution and performance remain unassessed.

Users

The guide suits developers who already use Ollama and want a model to request calculations, lookups or other application functions. Beginners can follow the small weather and arithmetic functions, although they need familiarity with functions, HTTP or an SDK, and conversation messages.

Experienced developers gain examples of message construction, function dispatch and streaming-state accumulation. Readers seeking a no-code assistant or complete deployment instructions will need material beyond this page.

Capabilities

The page covers one tool call, several calls returned in a response, an agent loop that continues requesting model responses, and streaming tool calls. Python functions can be passed directly to the SDK for automatic schema generation; explicit schemas are also supported. The JavaScript examples define schemas explicitly.

The examples labeled parallel tool calling demonstrate multiple requested calls in one response. Their Python and JavaScript handlers execute functions through ordinary loops; concurrent function execution is not demonstrated.

Using it

Requirements

The HTTP examples assume an Ollama chat endpoint at [http://localhost:11434/api/chat]. All examples name qwen3, so reproducing them requires that model to be available to the server. Python or JavaScript examples also require their respective runtime and Ollama client package. The JavaScript-tab examples are written in TypeScript, including type annotations and casts, and the single-call and parallel examples use top-level await. Running them as written requires a runtime or toolchain that runs TypeScript and a module context that permits top-level await. Every Python and JavaScript example passes think=True or think: true; the page does not say whether they work unchanged with a model that does not produce thinking output.

The page does not specify minimum Ollama or SDK versions, a complete list of compatible models, operating-system requirements, or hardware and memory needs. It also assumes developers can provide the functions that requested tools will execute.

Mechanism

A request supplies conversation messages and tool definitions containing function names, descriptions and parameter schemas. The model can return tool_calls containing function names and arguments. Application code dispatches those requests to implemented functions, preserves the assistant message, and appends each result as a tool message with tool_name and content.

A follow-up request lets the model use those results. The agent-loop examples repeat until a response contains no tool calls. For streaming, the page instructs developers to accumulate thinking, content and tool_calls from the chunks and return the assembled assistant message together with tool results.

Setup

The documented Python installation options are pip install ollama -U and uv add ollama. The JavaScript options are npm i ollama and bun i ollama. Direct HTTP examples use cURL instead of an SDK.

After choosing an interface, define the functions and schemas, create the initial messages, and implement result handling using the relevant example. Installing Ollama itself and obtaining qwen3 are not explained on this page. The final Python function-registration snippet also assumes messages has already been defined.

Example

The weather examples ask about New York or London and dispatch get_temperature and get_conditions. Their functions return fixed values from dictionaries or objects, such as 22°C for New York; they do not retrieve live weather. These values illustrate tool results and are not current observations.

The agent-loop example supplies add and multiply functions for the expression (11434+12341)*412. It illustrates how a model could request successive calculations, but the page supplies no recorded run establishing the actual call sequence or final response.

Assessment & evidence

Limitations

The single-call SDK examples process only the first returned call; a code comment recommends that approach only for models that return a single tool call. Applications receiving several calls need the multi-call handling pattern. The examples provide no measurements of function-selection accuracy, argument correctness, latency or throughput.

The agent loops have no demonstrated iteration limit or timeout. The handlers do not demonstrate runtime argument validation, function-failure recovery or permission controls for consequential actions. TypeScript argument casts do not themselves validate incoming values at runtime.

Reasoning

The documented design suggests a good fit when an application needs a model to choose among developer-provided functions while application code controls execution. The examples make that division concrete through explicit dispatch and returned tool messages.

For a bounded interaction, the single-response pattern may be sufficient; tasks whose later calls depend on earlier results may benefit from the repeated loop. These are architectural implications of the examples, not measured comparisons of reliability or efficiency.

Alternatives

Within this page, cURL exposes the HTTP message bodies directly, Python offers automatic schema generation from functions, and JavaScript demonstrates explicit schemas with application-side dispatch. These are alternative implementation routes for the same documented capability.

Other model runners, SDKs and agent frameworks are not evaluated here. The page supplies no comparative benchmarks or migration guidance.

Evidence

The evidence is the complete Ollama documentation page at [https://docs.ollama.com/capabilities/tool-calling.md], containing explanations, request bodies and SDK examples. It supports the documented integration patterns but supplies no execution logs, benchmark results or measured success rates.

No code was executed. Installation success, model availability, example correctness in a particular environment and runtime behavior remain untested.

Access & freshness

Costs

Operating cost is unknown. The page supplies no pricing, compute-cost estimates or usage measurements. The localhost endpoint and package installation commands do not establish that an implementation has zero cost. Costs for model execution and any services connected through functions are not established.

Rights

The page contains no licence text or redistribution terms for its documentation, example code, client packages or qwen3 model. Applicable permissions are unknown from this resource; the presence of installation commands does not establish reuse or redistribution rights.

Freshness

The page was captured on 2026-11-14 (09:48 UTC).

The page provides no publication date, update date or pinned Ollama, SDK or model release. Compatibility with a particular installed version and subsequent documentation changes are unknown.

Actions

Start with the interface matching your application language and a small deterministic function. Confirm tool-calling support for your intended model and installed versions, then check that assistant calls and tool results are preserved in the conversation.

Before extending the examples to external services, add argument validation, explicit function dispatch, failure handling and a bounded loop. Handle every returned call when multiple calls are possible, and preserve all accumulated response fields when streaming. Establish operating costs and applicable licences separately.

Evidence for this report

selected-page.txtselected · checked 2026-11-14