Skip to main content

llm-toolcall-check

Check whether your local LLM server handles tool calling correctly.

Ollama, vLLM, llama.cpp, LM Studio and SGLang all offer an OpenAI-compatible API, but tool calling is where they break most often: the tool call comes back as plain text, streamed arguments arrive broken, parallel calls get merged, or tool_choice is ignored. Your agent then fails with an error that looks like the model's fault.

llm-toolcall-check sends a set of small, realistic requests and tells you exactly what went wrong, and whose fault it is: the server's (a bug to report) or the model's (pick another model).

$ llm-toolcall-check --server ollama --model qwen3:4b
Checking qwen3:4b at http://localhost:11434/v1 (3 runs per check)

  ✔ single              3/3  One tool call
  ✔ streaming           3/3  One tool call, streamed
  ✔ parallel            3/3  Two tool calls in one reply
  ✔ parallel-streaming  3/3  Two tool calls, streamed
  ✔ tool-result         3/3  Answer from a tool result
  ✔ no-tool             3/3  No tool call when none is needed
  ✖ choice-required     0/3  tool_choice 'required'
      server: ignored tool_choice 'required' and answered in text (3x)
  ✖ choice-named        0/3  tool_choice naming a function
      server: ignored tool_choice naming get_weather and answered in text (3x)
  ✖ choice-none         0/3  tool_choice 'none'
      server: ignored tool_choice 'none' and called a tool (3x)
  ✔ nested-arguments    3/3  Nested arguments (objects, arrays, enums)
  ✔ unicode             3/3  Non-ASCII arguments, streamed
  ✔ structured-output   3/3  response_format json_schema

Passed 9 of 12 checks.
Server problems in: choice-required, choice-named, choice-none. These are bugs to report to the server.

Install

pip install llm-toolcall-check

Python 3.10 or newer. No dependencies.

Usage

Start your server, then point llm-toolcall-check at it:

llm-toolcall-check --server ollama --model qwen3:4b
llm-toolcall-check --server vllm                     # uses the only model the server lists
llm-toolcall-check --base-url http://gpu-box:8000/v1 --model Qwen/Qwen3-8B
Option Meaning
--server NAME Default local URL for ollama, vllm, sglang, llama.cpp or lmstudio
--base-url URL Any OpenAI-compatible base URL (default: $OPENAI_BASE_URL, then Ollama)
-m, --model NAME Model to test (default: the only model the server lists)
--api-key KEY API key (default: $LLM_TOOLCALL_CHECK_API_KEY, then $OPENAI_API_KEY)
-n, --runs N Runs per check (default: 3). Models are not fully deterministic, so failures show as 2/3
--only IDS, --skip IDS Comma-separated check ids, see --list
--markdown Print a Markdown table you can paste into a bug report
--json Print JSON
--fail-on-model Also exit 1 when only the model made mistakes
--timeout SECONDS Per request (default: 120)

Exit codes: 0 no server problems, 1 server problems found, 2 the check could not run (for example the server is not reachable).

The checks

Id What it sends What it catches
single "What's the weather in Paris?" with one tool Tool call returned as text, missing id, arguments as an object instead of a string, wrong finish_reason
streaming The same, with stream: true Broken deltas, missing index, name sent twice, no [DONE]
parallel Two cities in one question Calls merged into one, duplicate ids
parallel-streaming The same, streamed Arguments of two calls glued together
tool-result A conversation with a tool result Server rejects role: tool or content: null
no-tool A question that needs no tool Model calls tools anyway
choice-required tool_choice: "required" Server ignores it
choice-named tool_choice naming one function Server ignores it or calls another tool
choice-none tool_choice: "none" Server still calls tools, or leaks raw tool markup
nested-arguments A tool with objects, arrays and enums Arguments that don't match the schema
unicode "Zürich", streamed Mangled non-ASCII text such as Zürich or \u00fc
structured-output response_format: json_schema Server doesn't enforce the schema

Every response is also scanned for raw template tokens such as <tool_call>, [TOOL_CALLS], <|python_tag|> or <|im_end|>, which mean the server's parser missed something.

Server problem or model problem?

  • server: the server broke the OpenAI API contract. The model may have produced a perfect tool call, but the server returned it as text, mangled it while streaming, or ignored a request option. Report these to the server project; --markdown gives you a ready table.
  • model: the server did its job, but the model chose badly: no tool call, the wrong tool, or arguments that don't match the schema. Try a bigger model or a different quantization.

Same model, different servers

Qwen3 4B (Q4_K_M), 3 runs per check, November 2026:

Check Ollama 0.40.18 llama.cpp 1.1.0 (--jinja)
single, streaming, parallel, tool-result, no-tool ✔ ✔
choice-required ✖ ignored ✔
choice-named ✖ ignored ✔
choice-none ✖ still calls tools ✖ tool call leaks into content as <tool_call>…
nested-arguments, unicode, structured-output ✔ ✔

Both are known upstream: ollama#17921 and llama.cpp#30434.

Use in CI

Test a model and server combination before you deploy it:

- run: pip install llm-toolcall-check
- run: llm-toolcall-check --base-url http://localhost:8000/v1 --model my-model --markdown >> "$GITHUB_STEP_SUMMARY"

How it works

llm-toolcall-check talks to /v1/chat/completions with the Python standard library and looks at the raw JSON, not at what an SDK makes of it. Streamed replies are put back together the way the OpenAI SDKs do it (string fields are concatenated), so it reports what your agent would actually see. Requests use temperature: 0.

Nothing is sent anywhere except the server you point it at.

License

MIT

Metadata

Release files for llm-toolcall-check 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llm-toolcall-check 0.1.0
File Size Uploaded Provenance Actions
llm_toolcall_check-0.1.0.tar.gz 17.4 kB With provenance Details for llm_toolcall_check-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llm-toolcall-check 0.1.0
File Interpreter ABI Platform Actions
llm_toolcall_check-0.1.0-py3-none-any.whl Python 3 none any Details for llm_toolcall_check-0.1.0-py3-none-any.whl

Total release size: 35.1 kB

Release files / llm_toolcall_check-0.1.0.tar.gz

Download URL llm_toolcall_check-0.1.0.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c5dbca34b5451c002e7a9db00e228ebe062e29b117365394a0c8eccfc86065db
BLAKE2b-256 checksum
How to use checksums
957eb7735281e1dd0fc9994db9a63e7531b33b6a14269e64ed9647c9460418a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / llm_toolcall_check-0.1.0-py3-none-any.whl

Download URL llm_toolcall_check-0.1.0-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f06166ea5d343e1379b606cf71188c4980aa9d143581d2844bfa564a8110724
BLAKE2b-256 checksum
How to use checksums
05f1da202f8f494da3df303128f6876a49b5d68eff9eecbac52f6dbae537b7fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for llm-toolcall-check 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for llm_toolcall_check-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page