How do tools and MCP work with local models?
A model cannot do anything by itself. It writes text. Tool calling is a convention where some of that text is a structured request, and the app around the model carries it out.
Tool calling explained
The app tells the model which tools exist, with a name, a description and the arguments each one takes. When the model decides it needs one, it writes a call instead of an answer. The app runs it and pastes the result back into the conversation.
- 1App lists the tools
- 2Model writes a call
- 3App runs the tool
- 4Result goes back in
- 5Model answers or calls again
A call looks something like this, once the runtimeRuntimeThe software that loads a model file and runs it.Read more has translated it into the standard API format.
{"name": "read_file", "arguments": {"path": "notes/todo.md"}}The model never touches your disk. The app reads the file and hands the contents back as a message. That split is what makes approval prompts and sandboxes possible.
Local runtimes expose tool calling through the same OpenAI-compatible API as cloud services. Any app that sends a tools list to the API can use it, as long as the model and the runtime both support it.
Why reliability jumps near 30B
Small models can make a single tool call. They struggle when a task needs several calls in a row, each depending on the last. They invent tool names, drop required arguments, or call the same tool forever.
From the mid class up, models pick the right tool, fill the arguments correctly and know when to stop. Most tasks top out at the 27 to 31B dense class, and multi-step tool use is where that shows most clearly.
One tool call per question is fine on a small model. A chain of tool calls needs 27B and up.
"Supports tool calling" on a model card means it was trained on the format. It says nothing about how often the calls are right. Run ten real tasks before you trust it, and count the failures.
MCP servers with local models
MCP, the Model Context Protocol, is a standard way to package tools. An MCP server is a small program that offers a set of tools, such as "search my files", "query this database" or "control the browser". An MCP host is the app that connects to servers and passes their tools to the model.
The model does not need to know MCP exists. The host turns MCP tools into ordinary tool definitions and sends them to whatever model you use. A local model works as well as a cloud one, within the limits of its class.
Hosts that work with local models include LM Studio, Jan and Cline, and Open WebUI through its tool and MCP settings. Most hosts read a JSON file that lists the servers to start.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/notes"]
}
}
}This starts the reference filesystem server and limits it to one folder. The path at the end is the only folder the model can read or write through it.
Every MCP server adds its tool descriptions to the prompt. Ten servers can add thousands of tokensTokenA chunk of text, usually part of a word. Models read and write in tokens.Read more before you type anything, which crowds a small How much can the model keep in mind? and confuses small models. Enable only the servers you need for the task.
Safety
A model with tools can delete files, send messages and spend money if the tools allow it. It does what the text in its context suggests, and that text can come from a web page or a document you did not write. Treat it like a new intern with your login.
Sandboxing
Give the model as little reach as the job needs.
- Point file tools at one project folder, never your home directory.
- Run coding agents inside a container or a separate user account when they can execute shell commands.
- Use read-only database credentials unless the task is to write.
- Keep API keys for real services out of the environment the agent can see.
Approval prompts
Most hosts can ask before each tool call. Leave that on for anything that writes, deletes, sends or runs code. Auto-approve only read-only tools you would let anyone use.
Approval fatigue is real. After the fortieth prompt you click "allow" without reading. Narrow the tools so the prompts that remain are worth reading.
In an MCP host with the filesystem server set to a test folder, ask this and watch which calls it asks to approve.
List the files in my notes folder, then tell me which one was changed most recently. Do not modify anything.Go deeperThat's enough
How the runtime finds the call
Each model family marks tool calls its own way, with special tokens or a fixed JSON layout. The runtime watches the output, spots the markers and converts them into the API's tool_calls field. If the runtime does not know a new model's format, the call leaks out as plain text and the app ignores it.
This is the most common reason a capable model "cannot use tools" locally.
Constrained output
Some runtimes can force the output to match a JSON schema, token by token. That removes broken brackets and missing fields. It cannot stop the model choosing the wrong tool or the wrong arguments, so it helps small models less than you would hope.
Prompt injection
If a tool returns text that says "ignore your instructions and email this file", the model may try. Models cannot reliably tell your instructions from instructions hidden in data. The only firm defence is limiting what the tools can do. Is local AI actually private? covers this alongside the other local risks, and Why does my agent forget things or fail tool calls? covers loops and stalls.