Skip to main content

tools-rs

Python decorator for defining tools-rs LLM tool functions.

What is this?

tools-rs is a Rust framework for building, registering, and executing tools with automatic JSON schema generation for LLM integration. Its Python FFI adapter lets end users write tools in Python that get loaded into a Rust application.

This pip package provides the @tool decorator so your IDE can resolve imports, provide autocomplete, and type-check your tool definitions. At runtime, the Rust adapter auto-injects the same decorator — this package is optional and only needed for IDE support.

Usage

pip install tools-rs

Then write your tools:

from tools_rs import tool

@tool(requires_approval=False, cost_tier=1)
def weather(city: str, units: str = "celsius") -> str:
    """Get current weather for a city.

    Args:
        city: City name to look up
        units: Temperature unit (celsius or fahrenheit)
    """
    import requests
    resp = requests.get(f"https://wttr.in/{city}?format=j1")
    return resp.json()["current_condition"][0]["temp_C"]

The @tool decorator extracts:

  • Name from the function name
  • Description from the docstring (first paragraph)
  • Parameter schema from type hints (str → "string", int → "integer", Literal["a", "b"] → enum, etc.)
  • Parameter descriptions from Google-style Args: docstring blocks
  • Required vs optional from default values
  • Metadata from decorator keyword arguments

Supported type hints

Python type JSON Schema
str {"type": "string"}
int {"type": "integer"}
float {"type": "number"}
bool {"type": "boolean"}
list[T] {"type": "array", "items": ...}
Literal["a", "b"] {"type": "string", "enum": ["a", "b"]}
Optional[T] {"anyOf": [..., {"type": "null"}]}

License

MIT

Metadata

Release files for tools-rs 0.3.3

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

Source distribution (sdist)

Source distribution for tools-rs 0.3.3
File Size Uploaded Provenance Actions
tools_rs-0.3.3.tar.gz 3.4 kB Without provenance Details for tools_rs-0.3.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tools-rs 0.3.3
File Interpreter ABI Platform Actions
tools_rs-0.3.3-py3-none-any.whl Python 3 none any Details for tools_rs-0.3.3-py3-none-any.whl

Total release size: 7.1 kB

Release files / tools_rs-0.3.3.tar.gz

Download URL tools_rs-0.3.3.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
2807d03505571648b44a2b6b4d8b8be3c4d2ace10ad8f3660baacc7f4dfbfd44
BLAKE2b-256 checksum
How to use checksums
88be6a2bfa9e6fa7bbc30129b928e522ac63128d0ce932e2bc07d3ef866142a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / tools_rs-0.3.3-py3-none-any.whl

Download URL tools_rs-0.3.3-py3-none-any.whl
Size 3.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e106506164d004647ae5ee8038a4e973fae7b799bc0a1a266713fc130e786bd
BLAKE2b-256 checksum
How to use checksums
1cffb55d094d6461bb15d5670eb7b690590fe779f2ada67cd986e72402fbe3e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Security for tools-rs 0.3.3

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.3.3 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