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
2 changes: 1 addition & 1 deletion crates/rmcp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ chrono = { version = "0.4.38", default-features = false, features = [
[features]
default = ["base64", "macros", "server"]
client = ["dep:tokio-stream"]
server = ["transport-async-rw", "dep:schemars"]
server = ["transport-async-rw", "dep:schemars", "dep:pastey"]
macros = ["dep:rmcp-macros", "dep:pastey"]
elicitation = []

Expand Down
4 changes: 2 additions & 2 deletions crates/rmcp/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::{borrow::Cow, fmt::Display};

use crate::ServiceError;
pub use crate::model::ErrorData;
#[deprecated(
note = "Use `rmcp::ErrorData` instead, `rmcp::ErrorData` could become `RmcpError` in the future."
Expand All @@ -21,8 +20,9 @@ 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)]
pub enum RmcpError {
#[cfg(any(feature = "client", feature = "server"))]
#[error("Service error: {0}")]
Service(#[from] ServiceError),
Service(#[from] crate::ServiceError),
#[cfg(feature = "client")]
#[error("Client initialization error: {0}")]
ClientInitialize(#[from] crate::service::ClientInitializeError),
Expand Down
4 changes: 2 additions & 2 deletions crates/rmcp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ pub use pastey::paste;
#[cfg(all(feature = "macros", feature = "server"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
pub use rmcp_macros::*;
#[cfg(all(feature = "macros", feature = "server"))]
#[cfg_attr(docsrs, doc(cfg(all(feature = "macros", feature = "server"))))]
#[cfg(any(feature = "macros", feature = "server"))]
#[cfg_attr(docsrs, doc(cfg(any(feature = "macros", feature = "server"))))]
pub use schemars;
#[cfg(feature = "macros")]
#[cfg_attr(docsrs, doc(cfg(feature = "macros")))]
Expand Down
9 changes: 5 additions & 4 deletions crates/rmcp/src/model/prompt.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use base64::engine::{Engine, general_purpose::STANDARD as BASE64_STANDARD};
use serde::{Deserialize, Serialize};

use super::{
AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource, RawImageContent,
AnnotateAble, Annotations, Icon, Meta, RawEmbeddedResource,
content::{EmbeddedResource, ImageContent},
resource::ResourceContents,
};
Expand Down Expand Up @@ -138,11 +137,13 @@ impl PromptMessage {
meta: Option<crate::model::Meta>,
annotations: Option<Annotations>,
) -> Self {
use base64::{Engine, prelude::BASE64_STANDARD};

let base64 = BASE64_STANDARD.encode(data);
Self {
role,
content: PromptMessageContent::Image {
image: RawImageContent {
image: crate::model::RawImageContent {
data: base64,
mime_type: mime_type.into(),
meta,
Expand Down Expand Up @@ -215,7 +216,7 @@ mod tests {

#[test]
fn test_prompt_message_image_serialization() {
let image_content = RawImageContent {
let image_content = crate::model::RawImageContent {
data: "base64data".to_string(),
mime_type: "image/png".to_string(),
meta: None,
Expand Down
Loading