descry-tool-core 0.3.1

Core traits and types for descry-tool framework
Documentation
//! 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,
//!         })
//!     }
//! }
//! ```

pub mod adapters;
pub mod context;
pub mod error;
pub mod registry;
pub mod tool;
pub mod types;

#[cfg(feature = "tower")]
pub mod tower;

// Re-exports
pub use context::{Meta, ToolContext};
pub use error::ToolError;
pub use registry::{
    all_tools, call_tool, find_tool, get_tool_examples, get_tool_schema, tool_count, tool_exists,
    tool_names, ToolMeta,
};
pub use tool::{HasAnnotations, Tool};
pub use types::JsonObject;

// Re-export adapters
pub use adapters::{AnthropicAdapter, McpAdapter, OpenAiAdapter, ToolAdapter};

// Re-export Tower types (optional)
#[cfg(feature = "tower")]
pub use tower::{tool_service, tool_service_for, ToolRequest, ToolResponse, ToolService};

// Re-export schemars for convenience
pub use schemars::JsonSchema;