# 🎁 Trinkets
Tool registry and execution system for AI agents - goblin loot and treasures.
[](https://crates.io/crates/trinkets)
[](https://docs.rs/trinkets)
[](LICENSE)
## Overview
Trinkets provides a unified system for AI agents to discover and execute tools:
- **Tool Trait**: Simple interface for implementing tools
- **Registry**: Central registry for tool discovery
- **Router**: Routes tool calls to appropriate handlers
- **Orchestrator**: Coordinates parallel/sequential execution
## Features
- 🔧 Easy-to-implement `Tool` trait
- 📋 JSON Schema support for LLM function calling
- ⚡ Parallel tool execution with concurrency limits
- 🔒 Risk-based approval system
- 🛠️ Built-in tools (shell, file, search)
## Installation
```toml
[dependencies]
trinkets = "0.1"
```
## Usage
```rust
use trinkets::{Tool, ToolRegistry, ToolContext, ToolOutput};
use async_trait::async_trait;
use serde_json::{json, Value};
struct MyTool;
#[async_trait]
impl Tool for MyTool {
fn name(&self) -> &str { "my_tool" }
fn description(&self) -> &str { "Does something useful" }
fn parameters_schema(&self) -> Value {
json!({
"type": "object",
"properties": {
"input": { "type": "string" }
}
})
}
async fn execute(
&self,
ctx: &ToolContext,
args: Value
) -> Result<ToolOutput, trinkets::ToolError> {
Ok(ToolOutput::success("Done!"))
}
}
// Register and use
let mut registry = ToolRegistry::new();
registry.register(MyTool);
let schemas = registry.schemas(); // For LLM function calling
```
## Built-in Tools
- `shell` - Execute shell commands
- `read_file` - Read file contents
- `write_file` - Write to files
- `list_files` - List directory contents
- `grep` - Search with ripgrep
- `glob` - Find files by pattern
## Part of the Goblin Family
- [warhorn](https://crates.io/crates/warhorn) - Protocol types
- **trinkets** - Tool registry (you are here)
- [wardstone](https://crates.io/crates/wardstone) - Sandboxing
- [skulk](https://crates.io/crates/skulk) - MCP connections
- [hutch](https://crates.io/crates/hutch) - Checkpoints
- [ambush](https://crates.io/crates/ambush) - Task planning
- [cabal](https://crates.io/crates/cabal) - Orchestration
## License
MIT OR Apache-2.0