turbomcp_client/
prelude.rs

1//! Prelude module for convenient imports
2//!
3//! This module re-exports the most commonly used types for building
4//! applications with the TurboMCP client library.
5//!
6//! # Example
7//!
8//! ```rust,no_run
9//! use turbomcp_client::prelude::*;
10//!
11//! #[tokio::main]
12//! async fn main() -> Result<()> {
13//!     // All common types are available without deep imports
14//!     let client = Client::new(StdioTransport::new());
15//!     client.initialize().await?;
16//!
17//!     let tools = client.list_tools().await?;
18//!     println!("Found {} tools", tools.len());
19//!
20//!     Ok(())
21//! }
22//! ```
23
24pub use crate::{
25    CachePlugin,
26    CancellationHandler,
27    CancelledNotification,
28    // Core client types
29    Client,
30    ClientBuilder,
31    ClientCapabilities,
32    // Plugin system
33    ClientPlugin,
34    ConnectionConfig,
35    ElicitationAction,
36    // Handlers (bidirectional communication)
37    ElicitationHandler,
38    ElicitationRequest,
39    ElicitationResponse,
40    Error,
41
42    HandlerError,
43    HandlerResult,
44
45    InitializeResult,
46
47    LogHandler,
48    LoggingNotification,
49    MetricsPlugin,
50    PluginConfig,
51    PluginContext,
52    PluginError,
53    PluginResult,
54    ProgressHandler,
55    ProgressNotification,
56    PromptListChangedHandler,
57    ResourceListChangedHandler,
58    ResourceUpdateHandler,
59    ResourceUpdatedNotification,
60    // Result/Error (most commonly used) - re-exported from turbomcp_protocol
61    Result, // Note: This is Result<T, Box<Error>> from protocol
62    RetryPlugin,
63    RootsHandler,
64    // Sampling
65    SamplingHandler,
66    ServerInfo,
67    ToolListChangedHandler,
68    UserInteractionHandler,
69};
70
71// Transport re-exports (with feature gates - must be separate items)
72#[cfg(feature = "stdio")]
73pub use crate::StdioTransport;
74
75// Note: HTTP transport removed - use streamable_http_v2 from turbomcp-transport directly
76// #[cfg(feature = "http")]
77// pub use crate::HttpTransport;
78
79#[cfg(feature = "tcp")]
80pub use crate::TcpTransport;
81
82#[cfg(feature = "unix")]
83pub use crate::UnixTransport;
84
85#[cfg(feature = "websocket")]
86pub use crate::WebSocketBidirectionalTransport;
87
88// Re-export commonly used protocol types
89pub use turbomcp_protocol::types::{
90    CompleteResult,
91
92    // Completion
93    CompletionContext,
94    Content,
95    // Messaging
96    CreateMessageRequest,
97    CreateMessageResult,
98    EmbeddedResource,
99    ImageContent,
100    // Logging
101    LogLevel,
102
103    // Progress
104    ProgressNotification as ProtocolProgressNotification,
105    ProgressToken,
106
107    Prompt,
108    Resource,
109    ResourceContents,
110
111    Role,
112    // Roots
113    Root,
114    StopReason,
115
116    TextContent,
117    // Core types
118    Tool,
119};
120
121// Re-export async-trait for handler implementations
122pub use async_trait::async_trait;
123
124// Re-export Arc for handler registration
125pub use std::sync::Arc;