registry.ollama.ai/library/gemma3:12b does not support tools means you sent a
chat request with tools to a model that Ollama cannot run with tools. The API answers it
with HTTP 400; in .NET it arrives as
OllamaSharp.Models.Exceptions.ModelDoesNotSupportToolsException. Your code is
fine; pick a model that supports tool calling, such as qwen2.5:3b.
Change only the model name. The same UseFunctionInvocation() pipeline and the
same AIFunctionFactory.Create tool then work, and the model calls your method.
To check a model before you choose it, run ollama show and look for
tools under Capabilities.
The error
Unhandled exception. OllamaSharp.Models.Exceptions.ModelDoesNotSupportToolsException: registry.ollama.ai/library/gemma3:12b does not support tools
at OllamaSharp.OllamaApiClient.EnsureSuccessStatusCodeAsync(HttpResponseMessage response)
Why it happens
A model in Ollama can take tools only when its chat template knows how to describe them to
the model and how to read a tool call back. When a request carries a tools
list and the model's template has no such support, the server rejects the request before
generating anything. OllamaSharp reads that rejection and throws its own
ModelDoesNotSupportToolsException, with the model's full registry name in the
message.
Gemma 3 is a capable chat model, which is what makes this confusing: it answers ordinary prompts well, and the failure appears only once you add a tool. The function-invocation middleware from Microsoft.Extensions.AI is not the cause; it simply passes your tools on to the client.
The fix
IChatClient ollama = new OllamaApiClient(new Uri(baseUrl), model);
IChatClient client = new ChatClientBuilder(ollama)
.UseFunctionInvocation()
.Build();
var options = new ChatOptions
{
Tools = [AIFunctionFactory.Create(GetOpenSlots)]
};
var reply = await client.GetResponseAsync(
"How many appointment slots are open on Friday? Use the tool.", options);
Console.WriteLine(reply.Text);
PS> dotnet run --no-build -- qwen2.5:3b http://localhost:11434 tool
[tool] GetOpenSlots(weekday: Friday)
There are 3 open appointment slots available on Friday.
The code is unchanged between the failing and the working run; only the model argument
moved from gemma3:12b to qwen2.5:3b. The first output line is
printed by the tool method itself, which proves the model called it. On the Ollama library
site, models that support tool calling carry a "tools" label; check it before you choose a
model for an agent. If you need Gemma for its answers, keep it for plain chat and route
tool-using requests to a second client on a tool-capable model.
The raw message from the API, and how to check a model
Outside .NET the same rejection is a plain HTTP answer. A /api/chat request
with one tool, sent with curl to the small gemma3:270m:
> type body-tools.json
{"model":"gemma3:270m","stream":false,"messages":[{"role":"user","content":"What is the weather in Paris?"}],"tools":[{"type":"function","function":{"name":"get_weather","description":"Get the current weather for a city","parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}}}]}
> curl.exe -s -i http://127.0.0.1:15190/api/chat -d "@body-tools.json"
HTTP/1.1 400 Bad Request
Content-Type: application/json; charset=utf-8
Date: Sun, 22 Nov 2026 02:09:25 GMT
Content-Length: 73
{"error":"registry.ollama.ai/library/gemma3:270m does not support tools"}
The same body with only the model changed to qwen2.5:0.5b got
200 OK and a tool_calls entry for get_weather with
the argument Paris. The first body without its tools field got
200 OK from gemma3:270m as well, so the model was loaded and
answering; only the tools were refused. ollama show tells the two apart
before any request is sent:
> ollama show gemma3:270m
...
Capabilities
completion
...
> ollama show qwen2.5:0.5b
...
Capabilities
completion
tools
...
How it was reproduced
The API capture is from November 22, 2026 on Ollama 0.40.16 for Windows: a server of the
test's own on 127.0.0.1:15190, curl.exe run from
cmd.exe with each request body in a file, and the models
gemma3:270m and qwen2.5:0.5b. The .NET run is older:
a console app from dotnet new console -n FixLab -f net10.0 on .NET SDK
10.0.401, with Microsoft.Extensions.AI 10.10.0 and OllamaSharp 5.5.0, against Ollama 0.40.1
on Windows 11. The tool is a small static method, GetOpenSlots(string weekday),
with fictional data. The program takes the model name, base URL and mode from its
arguments, so both runs used the same build: gemma3:12b failed as shown and
qwen2.5:3b answered. The stack trace above is cut after its first frame.
Frequently asked
- Why does Ollama say a model does not support tools?
- The request included a tools list and the model's chat template has no tool-calling support, so the server rejects it. Use a model that supports tools, such as qwen2.5.
- Which Ollama models support tool calling?
- Run ollama show with the model name and look for tools under Capabilities; on the Ollama library site the same models carry a tools label. In these tests qwen2.5:3b and qwen2.5:0.5b called the tool, and gemma3:12b and gemma3:270m were rejected.
- Is ModelDoesNotSupportToolsException a bug in OllamaSharp or Microsoft.Extensions.AI?
- No. OllamaSharp turns the server's rejection into this exception. The code is correct; changing only the model name to a tool-capable one makes the same code work.
More decoded errors in the Fixes category.