fix(build): fix build of the project when no features are selected (#606)
This commit is contained in:
parent
46e149ee8b
commit
acb06ea819
4 changed files with 37 additions and 2 deletions
|
|
@ -208,3 +208,25 @@ path = "tests/test_task.rs"
|
||||||
name = "test_streamable_http_priming"
|
name = "test_streamable_http_priming"
|
||||||
required-features = ["server", "client", "transport-streamable-http-server", "reqwest"]
|
required-features = ["server", "client", "transport-streamable-http-server", "reqwest"]
|
||||||
path = "tests/test_streamable_http_priming.rs"
|
path = "tests/test_streamable_http_priming.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"
|
||||||
|
|
||||||
|
|
||||||
|
[[test]]
|
||||||
|
name = "test_close_connection"
|
||||||
|
required-features = ["server", "client"]
|
||||||
|
path = "tests/test_close_connection.rs"
|
||||||
|
|
|
||||||
|
|
@ -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.
|
/// This is an unified error type for the errors could be returned by the service.
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
#[allow(clippy::large_enum_variant)]
|
||||||
pub enum RmcpError {
|
pub enum RmcpError {
|
||||||
#[error("Service error: {0}")]
|
#[error("Service error: {0}")]
|
||||||
Service(#[from] ServiceError),
|
Service(#[from] ServiceError),
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,14 @@
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use anyhow::Result;
|
//! 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;
|
//! use tokio::process::Command;
|
||||||
//!
|
//!
|
||||||
|
//! #[cfg(feature = "transport-child-process")]
|
||||||
|
//! #[cfg_attr(docsrs, doc(cfg(feature = "transport-child-process")))]
|
||||||
//! async fn client() -> Result<()> {
|
//! async fn client() -> Result<()> {
|
||||||
//! let service = ().serve(TokioChildProcess::new(Command::new("uvx").configure(|cmd| {
|
//! let service = ().serve(TokioChildProcess::new(Command::new("uvx").configure(|cmd| {
|
||||||
//! cmd.arg("mcp-server-git");
|
//! cmd.arg("mcp-server-git");
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,15 @@
|
||||||
//!
|
//!
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! # use rmcp::{
|
//! # 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
|
//! // create transport from tcp stream
|
||||||
|
//! #[cfg(feature = "client")]
|
||||||
|
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
|
||||||
//! async fn client() -> Result<(), Box<dyn std::error::Error>> {
|
//! async fn client() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
//! let stream = tokio::net::TcpSocket::new_v4()?
|
//! let stream = tokio::net::TcpSocket::new_v4()?
|
||||||
//! .connect("127.0.0.1:8001".parse()?)
|
//! .connect("127.0.0.1:8001".parse()?)
|
||||||
|
|
@ -55,6 +60,8 @@
|
||||||
//! }
|
//! }
|
||||||
//!
|
//!
|
||||||
//! // create transport from std io
|
//! // create transport from std io
|
||||||
|
//! #[cfg(feature = "client")]
|
||||||
|
//! #[cfg_attr(docsrs, doc(cfg(feature = "client")))]
|
||||||
//! async fn io() -> Result<(), Box<dyn std::error::Error>> {
|
//! async fn io() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
//! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?;
|
//! let client = ().serve((tokio::io::stdin(), tokio::io::stdout())).await?;
|
||||||
//! let tools = client.peer().list_tools(Default::default()).await?;
|
//! let tools = client.peer().list_tools(Default::default()).await?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue