magi-tool
Tool schema generation and MCP service management for LLM tool calling.
Features
- Tool Schema Generation - Convert Rust types to JSON Schema for LLM tool definitions
- PegBoard (optional) - Manage multiple MCP services with automatic tool discovery and namespace conflict resolution
- Thread-Safe - Designed for concurrent access in async Rust applications
- Type-Safe - Full Rust type safety for tool parameters
Feature Flags
pegboard(enabled by default) - Includes the PegBoard service manager and rmcp integration- Disable with
default-features = falseif you only need tool schema generation
- Disable with
# Full features (default)
= "0.0.1"
# Tool schema generation only (faster compile, smaller binary)
= { = "0.0.1", = false }
Quick Example
use ;
use JsonSchema;
use Arc;
async
Documentation
See the docs/ folder for comprehensive documentation:
- Getting Started - Overview and quick start
- PegBoard Design - Complete API reference and architecture
- Tokio Usage - Async patterns and examples
- Optional Namespace - When and how to use namespaces
- Changes - Implementation history and migration guide
Key Concepts
Tool Schema Generation
Generate JSON schemas from Rust types for LLM tool definitions:
let tool = ?;
PegBoard with Namespace Support
Manage multiple MCP services with optional name prefixing:
// WITH namespace - tools get prefixed to avoid conflicts
pegboard.add_service.await?;
// tool "search" becomes "web-search"
// WITHOUT namespace - use original names
pegboard.add_service.await?;
// tool "add" stays "add"
Automatic Tool Discovery
PegBoard calls list_tools() on each service automatically:
// Register service - tools are discovered automatically
let count = pegboard.add_service.await?;
println!;
Testing
License
See workspace root for license information.