mcp_core/
lib.rs

1pub mod client;
2pub mod protocol;
3pub mod server;
4#[cfg(feature = "http")]
5pub mod sse;
6#[cfg(feature = "http")]
7pub use sse::http_server::run_http_server;
8pub mod tools;
9pub mod transport;
10pub mod types;
11
12#[macro_export]
13macro_rules! tool_error_response {
14    ($e:expr) => {{
15        let error_message = $e.to_string();
16        CallToolResponse {
17            content: vec![ToolResponseContent::Text {
18                text: error_message,
19            }],
20            is_error: Some(true),
21            meta: None,
22        }
23    }};
24}
25
26#[macro_export]
27macro_rules! tool_text_response {
28    ($e:expr) => {{
29        CallToolResponse {
30            content: vec![ToolResponseContent::Text { text: $e }],
31            is_error: None,
32            meta: None,
33        }
34    }};
35}