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
//! Descry Tool Core - Modern async-first tool framework
//!
//! Provides zero-cost, compile-time tool registration with modern Rust best practices.
//!
//! # Features
//!
//! - **Single async Tool trait** - No SyncTool/AsyncTool separation
//! - **Arc<ToolContext>** - No borrow checker hell, works across await points
//! - **Compile-time registration** - Using `inventory` for zero startup cost
//! - **Thread-local schema cache** - Generated once per type
//! - **Thread-safe** - `DashMap` for concurrent extensions
//! - **Error chaining** - `thiserror` with `#[source]` support
//! - **Multi-protocol adapters** - MCP, OpenAI, Anthropic built-in
//! - **Tower Service integration** - Middleware ecosystem support (optional)
//!
//! # Quick Start
//!
//! ```ignore
//! use descry_tool_core::{Tool, ToolContext, ToolError};
//! use serde::{Deserialize, Serialize};
//! use schemars::JsonSchema;
//! use std::sync::Arc;
//!
//! #[derive(Deserialize, JsonSchema)]
//! struct AddParams {
//! a: i32,
//! b: i32,
//! }
//!
//! #[derive(Serialize, JsonSchema)]
//! struct AddOutput {
//! result: i32,
//! }
//!
//! struct AddTool;
//!
//! impl Tool for AddTool {
//! type Params = AddParams;
//! type Output = AddOutput;
//!
//! const NAME: &'static str = "add";
//! const DESCRIPTION: &'static str = "Add two numbers";
//!
//! async fn call(
//! ctx: Arc<ToolContext>,
//! params: Self::Params,
//! ) -> Result<Self::Output, ToolError> {
//! Ok(AddOutput {
//! result: params.a + params.b,
//! })
//! }
//! }
//! ```
// Re-exports
pub use ;
pub use ToolError;
pub use ;
pub use ;
pub use JsonObject;
// Re-export adapters
pub use ;
// Re-export Tower types (optional)
pub use ;
// Re-export schemars for convenience
pub use JsonSchema;