Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion crates/rmcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,19 @@ path = "tests/test_elicitation.rs"
[[test]]
name = "test_task"
required-features = ["server", "client", "macros"]
path = "tests/test_task.rs"
path = "tests/test_task.rs"

[[test]]
name = "test_custom_request"
required-features = ["server", "client"]
path = "tests/test_custom_request.rs"

[[test]]
name = "test_prompt_macros"
required-features = ["server", "client"]
path = "tests/test_prompt_macros.rs"

[[test]]
name = "test_sampling"
required-features = ["server", "client"]
path = "tests/test_sampling.rs"
1 change: 1 addition & 0 deletions crates/rmcp/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl std::error::Error for ErrorData {}

/// This is an unified error type for the errors could be returned by the service.
#[derive(Debug, thiserror::Error)]
#[allow(clippy::large_enum_variant)]
pub enum RmcpError {
#[error("Service error: {0}")]
Service(#[from] ServiceError),
Expand Down
7 changes: 6 additions & 1 deletion crates/rmcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@
//!
//! ```rust
//! use anyhow::Result;
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt, transport::{TokioChildProcess, ConfigureCommandExt}};
//! use rmcp::{model::CallToolRequestParam, service::ServiceExt};
//! #[cfg(feature = "transport-child-process")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
//! use rmcp::transport::{TokioChildProcess, ConfigureCommandExt};
//! use tokio::process::Command;
//!
//! #[cfg(feature = "transport-child-process")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
//! async fn client() -> Result<()> {
//! let service = ().serve(TokioChildProcess::new(Command::new("uvx").configure(|cmd| {
//! cmd.arg("mcp-server-git");
Expand Down
9 changes: 8 additions & 1 deletion crates/rmcp/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@
//!
//! ```rust
//! # use rmcp::{
//! # ServiceExt, serve_client, serve_server,
//! # ServiceExt, serve_server,
//! # };
//! #[cfg(feature = "client")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
//! # use rmcp::serve_client;
//!
//! // create transport from tcp stream
//! #[cfg(feature = "client")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
//! async fn client() -> Result<(), Box<dyn std::error::Error>> {
//! let stream = tokio::net::TcpSocket::new_v4()?
//! .connect("127.0.0.1:8001".parse()?)
Expand All @@ -55,6 +60,8 @@
//! }
//!
//! // create transport from std io
//! #[cfg(feature = "client")]
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
//! async fn io() -> Result<(), Box<dyn std::error::Error>> {
//! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?;
//! let tools = client.peer().list_tools(Default::default()).await?;
Expand Down