Skip to main content

Crate tools_core

Crate tools_core 

Source

Re-exports§

pub use builder::ToolsBuilder;
pub use ffi::Language;
pub use ffi::RawToolDef;
pub use once_cell;

Modules§

builder
Typestate-based builder for ToolCollection.
ffi
FFI adapter types for scripting-language tool definitions.

Structs§

CallId
CollectionBuilder
Builder for ToolCollection with support for shared context injection. Construct via ToolCollection::builder().
DeserializationError
Specific deserialization errors
FunctionCall
Represents a function call with name and arguments
FunctionDecl
Function declaration for LLM consumption
FunctionResponse
Represents a function response with name and arguments
MetaValidationError
Per-tool attribute validation error. Reported by validate_tool_attrs and validate_tool_attrs_for.
NoMeta
Default metadata type for ToolCollection. Empty struct that deserializes from any JSON object, ignoring all fields. Use this when you don’t care about per-tool attributes.
Tool
Represents a tool that can be called
ToolCollection
Collection of registered tools, parameterized by a metadata type M.
ToolEntry
One entry in a ToolCollection: callable function, schema, and the metadata typed against the collection’s M parameter.
ToolMetadata
Metadata about a tool function
ToolRegistration
Tool registration for inventory collection. Constructed via struct literal in macro-generated code; field additions are minor-version breaking changes.
TypeSignature
Runtime type signature information

Enums§

ToolError
Errors that can occur during tool operations

Traits§

MetaArg
Helper trait that lets ToolCollection::register accept either a real M or () when M = NoMeta. Passing () to a typed collection fails at compile time — there’s no silent default.
ToolSchema
Trait for types that can generate a JSON Schema representation of themselves.

Functions§

validate_tool_attrs
Validate every registered tool’s #[tool(...)] attributes against M, accumulating all failures. Use in CI tests to catch attribute typos before they hit collect_tools at runtime.
validate_tool_attrs_for
Like validate_tool_attrs but only checks the named subset. Useful for workspaces with multiple metadata schemas, each gating a different group of tools. Returns an error for any name that does not match a registered tool — typos in the test list are as bad as typos in the attributes.

Type Aliases§

ToolFunc
Function signature for tools