//! # adk-tool
//!
//! Tool system for ADK agents (FunctionTool, MCP, Google Search, AgentTool).
//!
//! ## Overview
//!
//! This crate provides the tool infrastructure for ADK agents:
//!
//! - [`FunctionTool`] - Create tools from async Rust functions
//! - [`AgentTool`] - Use agents as callable tools for composition
//! - [`GoogleSearchTool`] - Web search via Gemini's grounding
//! - `McpToolset` - Model Context Protocol integration with the `mcp` feature
//! - `McpServerManager` - Multi-server lifecycle management with the `mcp` feature
//! - [`BasicToolset`] - Group multiple tools together
//! - [`ExitLoopTool`] - Control flow for loop agents
//! - [`LoadArtifactsTool`] - Inject binary artifacts into context
//!
//! ## Quick Start
//!
//! ```rust,no_run
//! use adk_tool::FunctionTool;
//! use adk_core::{ToolContext, Result};
//! use serde_json::{json, Value};
//! use std::sync::Arc;
//!
//! async fn get_weather(ctx: Arc<dyn ToolContext>, args: Value) -> Result<Value> {
//!     let city = args["city"].as_str().unwrap_or("Unknown");
//!     Ok(json!({
//!         "city": city,
//!         "temperature": 72,
//!         "condition": "sunny"
//!     }))
//! }
//!
//! let tool = FunctionTool::new(
//!     "get_weather",
//!     "Get current weather for a city",
//!     get_weather,
//! );
//! ```
//!
//! ## MCP Integration
//!
//! Connect to MCP servers for external tools:
//!
//! ```rust,ignore
//! use adk_tool::McpToolset;
//! use rmcp::{ServiceExt, transport::TokioChildProcess};
//!
//! let client = ().serve(TokioChildProcess::new(
//!     Command::new("npx")
//!         .arg("-y")
//!         .arg("@modelcontextprotocol/server-filesystem")
//!         .arg("/path/to/files")
//! )?).await?;
//!
//! let toolset = McpToolset::new(client);
//! ```

#![deny(missing_docs)]

mod agent_tool;
/// Built-in tool wrappers for Gemini, OpenAI, and Anthropic hosted tools.
pub mod builtin;
mod function_tool;
#[cfg(feature = "mcp")]
/// Model Context Protocol (MCP) integration: toolsets, server management, and resources.
pub mod mcp;
mod simple_context;
mod stateful_tool;
/// Toolset combinators: basic, filtered, merged, and prefixed toolsets.
pub mod toolset;

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

#[cfg(feature = "memory-tools")]
pub mod memory;

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

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

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

#[cfg(feature = "mcp-sampling")]
pub mod sampling;

pub use adk_core::{AdkError, Result, Tool, ToolContext, Toolset};
pub use adk_rust_macros::tool;

// Re-export async_trait so the #[tool] macro's generated code can reference it
// without requiring users to add async-trait as a direct dependency.
pub use agent_tool::{AgentTool, AgentToolConfig};
pub use async_trait::async_trait;
pub use builtin::{
    AnthropicBashTool20241022, AnthropicBashTool20250124, AnthropicTextEditorTool20250124,
    AnthropicTextEditorTool20250429, AnthropicTextEditorTool20250728, BypassBuiltinTool,
    BypassMultiToolsLimit, ExitLoopTool, GeminiCodeExecutionTool, GeminiComputerEnvironment,
    GeminiComputerUseTool, GeminiFileSearchTool, GoogleMapsContext, GoogleMapsTool,
    GoogleSearchTool, LoadArtifactsTool, OpenAIApplyPatchTool, OpenAIApproximateLocation,
    OpenAICodeInterpreterTool, OpenAIComputerEnvironment, OpenAIComputerUseTool,
    OpenAIFileSearchTool, OpenAIImageGenerationTool, OpenAILocalShellTool, OpenAIMcpTool,
    OpenAIShellTool, OpenAIWebSearchTool, UrlContextTool, WebSearchTool, WebSearchUserLocation,
};
pub use function_tool::FunctionTool;
#[cfg(feature = "mcp")]
pub use mcp::{
    AutoDeclineElicitationHandler, ElicitationHandler, McpAuth, McpHttpClientBuilder,
    McpServerManager, McpTaskConfig, McpToolset, OAuth2Config, Resource, ResourceContents,
    ResourceTemplate,
};
pub use simple_context::SimpleToolContext;
pub use stateful_tool::StatefulTool;
pub use toolset::{
    BasicToolset, FilteredToolset, MergedToolset, PrefixedToolset, string_predicate,
};

#[cfg(feature = "code")]
pub use code_execution::CodeTool;

#[cfg(feature = "code")]
pub use code_execution::FrontendCodeTool;

#[cfg(feature = "code")]
pub use code_execution::JavaScriptCodeTool;

#[cfg(feature = "code")]
pub use code_execution::PythonCodeTool;
