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
24// Version information
25pub use crate::{CRATE_NAME, VERSION};
26
27pub use crate::{
28    CachePlugin,
29    CancellationHandler,
30    CancelledNotification,
31    // Core client types
32    Client,
33    ClientBuilder,
34    ClientCapabilities,
35    // Plugin system
36    ClientPlugin,
37    ConnectionConfig,
38    ElicitationAction,
39    // Handlers (bidirectional communication)
40    ElicitationHandler,
41    ElicitationRequest,
42    ElicitationResponse,
43    Error,
44
45    HandlerError,
46    HandlerResult,
47
48    InitializeResult,
49
50    LogHandler,
51    LoggingNotification,
52    MetricsPlugin,
53    PluginConfig,
54    PluginContext,
55    PluginError,
56    PluginResult,
57    PromptListChangedHandler,
58    ResourceListChangedHandler,
59    ResourceUpdateHandler,
60    ResourceUpdatedNotification,
61    // Result/Error (most commonly used) - re-exported from turbomcp_protocol
62    Result, // Note: This is Result<T, Box<Error>> from protocol
63    RetryPlugin,
64    RootsHandler,
65    // Sampling
66    SamplingHandler,
67    ServerInfo,
68    ToolListChangedHandler,
69    UserInteractionHandler,
70};
71
72// Transport re-exports (with feature gates - must be separate items)
73#[cfg(feature = "stdio")]
74pub use crate::StdioTransport;
75
76#[cfg(feature = "http")]
77pub use crate::{RetryPolicy, StreamableHttpClientConfig, StreamableHttpClientTransport};
78
79#[cfg(feature = "tcp")]
80pub use crate::{TcpTransport, TcpTransportBuilder};
81
82#[cfg(feature = "unix")]
83pub use crate::{UnixTransport, UnixTransportBuilder};
84
85#[cfg(feature = "websocket")]
86pub use crate::{WebSocketBidirectionalConfig, 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    Prompt,
104    Resource,
105    ResourceContents,
106
107    Role,
108    // Roots
109    Root,
110    StopReason,
111
112    TextContent,
113    // Core types
114    Tool,
115};
116
117// Re-export Transport trait for generic bounds (e.g., LLM framework integrations)
118pub use turbomcp_transport::Transport;
119
120// Re-export async-trait for handler implementations
121pub use async_trait::async_trait;
122
123// Re-export Arc for handler registration
124pub use std::sync::Arc;