Skip to main content

ToolForm: tool interfaces, chosen by measurement

PyPI Python versions License: Apache 2.0 Documentation

Website · Documentation · Dashboard · PyPI · Paper (coming soon)

ToolForm decides how an agent shows its tools to a language model and reads back the calls. Give it your tools (OpenAI, Anthropic or MCP JSON, Python functions or TypeScript declarations) and your model: it recommends a schema format and an answer protocol from a controlled study of 129 formats, 31 answer protocols and 112 models, renders the tool block, parses and validates the reply, guards tool descriptions against hidden instructions, and handles long catalogues.

from toolform import Toolset, recommend, render, parse_reply

tools = Toolset.from_openai("tools.json")
rec = recommend(tools=tools, model="Qwen/Qwen3-8B")
print(rec.summary())   # xml_schema + xml_call, 93.14% expected (65.60 to 93.14 across the table values), checkpoint Qwen/Qwen3-8B

prompt = render(tools, rec.format_id, rec.protocol_id, request="Forecast for Denver, 5 days")
# send prompt.messages to any chat endpoint, then:
parsed = parse_reply(model_reply, tools, rec.protocol_id)
for call in parsed.calls:
    print(call.resolved_name, call.arguments, call.valid)

News

  • 2026-10-20 · ToolForm 0.0.1 is on PyPI: pip install toolform. The advisor, 129 formats, 31 answer protocols, the guard, catalogue tools, a command line, an HTTP API and a web dashboard.
  • 2026-10-20 · The website and the documentation are live.
  • Coming soon · The paper, ToolForm: A Controlled Study of Tool Formatting for Agents, on arXiv.

What the study found

The way a model is shown its tools sets three things: the schema format it reads, the answer protocol it writes back in, and the grading rule that scores the call. Prior comparisons changed the first two together; ToolForm's study changed one at a time. Four rules came out:

Rule Evidence
Show the parameter schema. It raises accuracy by 57.09% over tool names alone, the largest effect in the study.
Choose the answer protocol before the schema format. The protocol changes accuracy 1.22 to 2.00 times as much as the format.
Prefer a structured format to natural language. Natural language is never more accurate on average than the best structured format, at any model size.
Keep the tool list short, and treat tool descriptions as untrusted. Going from 1 to 256 tools costs 41.01%; an instruction hidden in a description is followed on 38.48 to 54.16% of turns.

And when you can reach the model, measure: testing eight formats on the target model (400 requests) reached 69.18%, against 64.35% for the best fitted rule and 57.97% for the JSON Schema default.

Install

pip install toolform                 # SDK and CLI
pip install "toolform[serve]"        # plus the HTTP API behind the dashboard

The advisor, the renderers, the parsers and the guard run offline from evidence that ships with the package. No GPU, no API key.

What's inside

Advisor a format and protocol for your model and tools, with the table behind every number; measure runs the eight-format test on your endpoint
Render and parse every format and protocol the study measured, the three grading rules as options, and argument validation
Guard scans tool descriptions for hidden instructions, invisible characters and other risky text, and cleans them
Catalogue names-first disclosure, BM25 or embedding retrieval, token budgets and a planner for long tool lists
Call loop runs a model and your Python tools against any OpenAI-compatible or Anthropic endpoint
Interfaces Python SDK, the toolform CLI, an HTTP API, and a web dashboard

Command line

toolform recommend --tools-file tools.json --model Qwen/Qwen3-8B   # format and protocol, with the evidence
toolform render tools.json --format xml_schema           # the tool block
toolform guard mcp_tools.json                            # scan a third-party manifest
toolform catalogue tools.json --context 32768            # plan a long catalogue
toolform serve                                           # the HTTP API

Documentation

Everything else, from the concepts to every SDK function, CLI option and API route, is in the documentation. Runnable examples are in examples/.

Contributing

Issues and pull requests are welcome; see CONTRIBUTING.md.

Citation

The paper, ToolForm: A Controlled Study of Tool Formatting for Agents, is coming soon. Until then, please cite the software:

@software{srivastava2026toolform,
  author  = {Srivastava, Gaurav},
  title   = {ToolForm: A Controlled Study of Tool Formatting for Agents},
  year    = {2026},
  url     = {https://github.com/ctrl-gaurav/toolform},
  version = {0.0.1}
}

License

Apache 2.0

Metadata

Release files for toolform 0.0.1

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

Source distribution (sdist)

Source distribution for toolform 0.0.1
File Size Uploaded Provenance Actions
toolform-0.0.1.tar.gz 493.8 kB Without provenance Details for toolform-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for toolform 0.0.1
File Interpreter ABI Platform Actions
toolform-0.0.1-py3-none-any.whl Python 3 none any Details for toolform-0.0.1-py3-none-any.whl

Total release size: 963.2 kB

Release files / toolform-0.0.1.tar.gz

Download URL toolform-0.0.1.tar.gz
Size 493.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4d636a8fc74e107b463af1edd353e8f063953fe301f107c136e7b3f6623df6e1
BLAKE2b-256 checksum
How to use checksums
1b8bbaeab49016e1472b4bbd1ab13e1594c25d8beb12a2d5cba58a27f02616fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Release files / toolform-0.0.1-py3-none-any.whl

Download URL toolform-0.0.1-py3-none-any.whl
Size 469.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f39c1f060198e74b0fbc2ea479441107accff91f50582211225daaaac2a0adb8
BLAKE2b-256 checksum
How to use checksums
b493d5ea3ed69af1d6e16d3c03639dd0a29136afc8ee2b5b568cbf6f635a5746
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.13

Security for toolform 0.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.0.1 This release

2 release files No 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