ricecoder_tools/
lib.rs

1//! RiceCoder Enhanced Tools
2//!
3//! Provides webfetch, patch, todo, and web search tools with hybrid MCP provider architecture.
4//!
5//! # Overview
6//!
7//! Enhanced Tools implements a hybrid provider pattern where built-in implementations provide
8//! default functionality, while optional MCP servers can override or extend behavior for
9//! advanced use cases.
10//!
11//! # Architecture
12//!
13//! All tools follow a provider priority chain:
14//!
15//! 1. **MCP Server** (if configured and available) - Custom implementations via external MCP servers
16//! 2. **Built-in Implementation** (fallback) - Default ricecoder implementation
17//! 3. **Error** (if both unavailable) - Report that tool is not available
18//!
19//! This enables:
20//! - Out-of-the-box functionality with built-in tools
21//! - Advanced customization via custom MCP servers
22//! - Graceful fallback when MCP is unavailable
23//! - Zero configuration required for basic use
24//!
25//! # Modules
26//!
27//! - [`error`] - Error types with context and suggestions
28//! - [`result`] - Result types with metadata about execution
29//! - [`provider`] - Provider trait and registry for tool implementations
30//! - [`webfetch`] - Webfetch tool for fetching web content
31//! - [`patch`] - Patch tool for applying unified diff patches
32//! - [`todo`] - Todo tools for managing task lists
33//! - [`search`] - Web search tool for searching the web
34//!
35//! # Example
36//!
37//! ```ignore
38//! use ricecoder_tools::provider::ProviderRegistry;
39//!
40//! #[tokio::main]
41//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
42//!     let registry = ProviderRegistry::new();
43//!
44//!     // Register providers
45//!     // registry.register_builtin_provider("webfetch", builtin_provider).await;
46//!
47//!     // Get provider and execute
48//!     // let provider = registry.get_provider("webfetch").await?;
49//!     // let result = provider.execute("https://example.com").await?;
50//!
51//!     Ok(())
52//! }
53//! ```
54
55pub mod error;
56pub mod patch;
57pub mod provider;
58pub mod result;
59pub mod search;
60pub mod todo;
61pub mod webfetch;
62
63// Re-export commonly used types
64pub use error::ToolError;
65pub use provider::{Provider, ProviderRegistry};
66pub use result::{ResultMetadata, ToolErrorInfo, ToolResult};
67pub use search::{SearchInput, SearchOutput, SearchResult, SearchTool};
68pub use todo::{
69    Todo, TodoPriority, TodoreadInput, TodoreadOutput, TodoStatus, TodoTools, TodowriteInput,
70    TodowriteOutput,
71};