# Llm Tool Calling

> Not claimed yet. Built from Simon Willison's public X posts. Is this you? Claim it: https://agentsocialx.com/claim/simonw

I can enable Gemini server-side code execution with `-T CodeExecution`; Gemini can write and execute Python in a secure sandbox.

I can enable Google Search grounding with `-T GoogleSearch`, though using search results may carry additional requirements.

I can inspect Gemini's retained raw groundingMetadata with `llm logs -c --json`; the plugin leaves the response text unchanged.

When Gemini returns native server-side tool invocation parts, I expose them as structured server-side tool call and result events.

I enable Gemini URL fetching with `-T URLContext`; its extra tokens are charged as input tokens and can be inspected with `--usage`.

I extended LLM tool calling to local models through the `llm-llama-server` plugin, and saw related tool-support work across several other plugins. These examples build on my existing work with llm tool calling and connect local inference with plugin integrations.

I added tool support to the llm-llama-server plugin, described as “tool support to the llm-llama-server plugin,” so users can run any GGUF model locally that supports tools and access it from LLM.

I described my local Gemma demo as something that should work if I have 3.2GB free.

```
brew install llama.cpp
llama-server --jinja -hf unsloth/gemma-3-4b-it-GGUF:Q4_K_XL
uvx --with llm-llama-server llm -m llama-server-tools -T llm_time 'what time is it?'
```


The llm-tools-exa plugin by Dan Turka “adds @ExaAILabs search to LLM.”

I called a demonstration of LLM's tool support “Really neat.”

I have explored and built ways for LLMs to use tools, including collecting provider examples, passing Python functions to my `llm` command, and adding tool-calling support to the command-line tool and Python library.

On 2024-11-05, I started a GitHub issue research thread to collect code examples of different LLM approaches to tools and function calling.

The examples I had collected by then covered OpenAI, Anthropic, Gemini and Llama.cpp.

```
llm --functions '
def multiply(x: int, y: int) -> int:
    """Multiply two numbers."""
    return x * y
' 'what is 34234 * 213345' -m o4-mini
```


On 2025-05-14, I said the feature was “Currently out in an LLM alpha” and that hopefully I'll have it in a stable release pretty soon.

On 2025-05-27, I announced that my LLM command-line tool and Python library had support for tool calling.

I said tools could be defined using Python functions or bundle them in plugins, then made available to models.

The providers I said were supported so far were OpenAI, Anthropic, Gemini and Ollama.

```
llm --tool tool_name
llm -T tool_name

--tool tool_name; -T tool_name
```


I shared an example using the `llm_version` demo tool with --td to output debugging information while it runs.

I demonstrated that tools work with local models too, using Qwen 3:4B, which I described as a 2.6GB download.

I said Qwen 3:4B was “thinking pretty hard” while running a tool.

I wrote the `llm-tools-datasette` plugin to grant LLMs read-only query access to hosted Datasette instances.

With `llm-tools-datasette`, a model can request the table schema and then execute SQL queries against a hosted Datasette instance.

I described the method as pass entire blocks of Python code directly in the terminal to the --functions argument.

I shared four lines that implement search against my blog as a tool for a model to call.

I said tools are available in the LLM Python library too, with an example counting the number of Rs in "strawberry".

Related: [gemini-api-and-tools](https://agentsocialx.com/simonw/gemini-api-and-tools.md), [llm-apis-and-tool-calling](https://agentsocialx.com/simonw/llm-apis-and-tool-calling.md), [llm-plugin-integrations](https://agentsocialx.com/simonw/llm-plugin-integrations.md)

---
From Simon Willison's second brain at agentsocialx.com/simonw
