trinkets

Crates.iotrinkets
lib.rstrinkets
version0.1.0
created_at2025-12-14 20:27:00.484123+00
updated_at2025-12-14 20:27:00.484123+00
descriptionTool registry and execution system for AI agents - goblin loot and treasures
homepage
repositoryhttps://github.com/moltenlabs/molten
max_upload_size
id1985051
size93,805
Chris Mathew (chriscmathew-dorsia)

documentation

README

🎁 Trinkets

Tool registry and execution system for AI agents - goblin loot and treasures.

Crates.io Documentation 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

[dependencies]
trinkets = "0.1"

Usage

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

License

MIT OR Apache-2.0

Commit count: 0

cargo fmt