1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// The `core::DynTool` / `core::FunctionTool` intra-doc links here are necessary
// on stable (a bare `DynTool` does not resolve because `core` is ambiguous with
// the std `core` crate). On nightly, `rustdoc::redundant_explicit_links` flags
// them anyway (a known false-positive under the ambiguity); allow it locally.
//! # Toolkits Module
//!
//! Tool definition, execution, caching, and LLM tool-call parsing utilities.
//! Supports both static tool definitions and dynamic registration at runtime.
//!
//! # Core Components
//!
//! - [`core`] — Core traits ([`DynTool`](core::DynTool), [`FunctionTool`]) and
//! type conversions
//! - [`error`] — Error types with context information
//! - [`executor`] — Execution engine with registration, caching, and retry
//! logic
//! - [`llm`] — LLM-specific parsing utilities (tool-call extraction)
//! - [`cache`] — In-memory tool-call cache with statistics
//!
//! # Feature-gated
//!
//! - `rmcp-kits` — RMCP protocol bridge for MCP tool calling
//!
//! # Quick Start
//!
//! ```no_run
//! use zai_rs::toolkits::prelude::*;
//! use serde_json::json;
//!
//! # fn main() -> ToolResult<()> {
//! let tool = FunctionTool::builder("get_weather", "Get current weather")
//! .property("location", json!({"type": "string"}))
//! .required("location")
//! .handler(|input| async move {
//! Ok(json!({"temperature": 22.5}))
//! })
//! .build()?;
//!
//! let executor = ToolExecutor::new();
//! executor.add_dyn_tool(Box::new(tool))?;
//! # Ok(())
//! # }
//! ```
/// In-memory tool-call cache with per-entry hit statistics.
/// Core traits ([`DynTool`](core::DynTool),
/// [`FunctionTool`](core::FunctionTool)) and type conversions.
/// Error types with context information.
/// Execution engine with registration, caching, and retry logic.
/// LLM-specific parsing utilities (tool-call extraction).
// RMCP bridge (feature-gated)
/// RMCP protocol bridge for MCP tool calling (feature `rmcp-kits`).
/// Prelude module for convenient imports
///
/// This module re-exports commonly used types and traits from the toolkits
/// module, making it easier to import everything needed for tool development
/// with a single `use` statement.
///
/// ## Usage
///
/// ```
/// use zai_rs::toolkits::prelude::*;
/// ```
// Re-export commonly used types at crate root for convenience via toolkits::
pub use crate;