Skip to content
Merged
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
12 changes: 10 additions & 2 deletions crates/mcp-cli/src/commands/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,11 @@ impl DebugCommand {
}
}
Err(e) => {
println!("❌ Failed to list resources: {}", e);
if e.to_string().contains("Method not found") {
println!("πŸ“ Resources (0):");
} else {
println!("❌ Failed to list resources: {}", e);
}
}
}

Expand All @@ -191,7 +195,11 @@ impl DebugCommand {
}
}
Err(e) => {
println!("❌ Failed to list prompts: {}", e);
if e.to_string().contains("Method not found") {
println!("πŸ’¬ Prompts (0):");
} else {
println!("❌ Failed to list prompts: {}", e);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions crates/mcp-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//! allowing developers to test and validate their MCP implementations before
//! deploying to production LLM hosts.

#![allow(clippy::uninlined_format_args)]

use anyhow::Result;
use clap::Parser;
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
Expand Down
4 changes: 2 additions & 2 deletions crates/mcp-core/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ impl McpClient {

// Connect transport
self.transport.connect().await.map_err(|e| {
let error = format!("Transport connection failed: {}", e);
let error = format!("Transport connection failed: {e}");
self.set_error_state(error.clone());
McpError::Protocol(ProtocolError::InitializationFailed { reason: error })
})?;
Expand Down Expand Up @@ -405,7 +405,7 @@ impl McpClient {

fn generate_request_id(&self) -> String {
let counter = self.request_counter.fetch_add(1, Ordering::SeqCst);
format!("req_{}", counter)
format!("req_{counter}")
}

async fn start_message_processing(&mut self) -> McpResult<()> {
Expand Down
1 change: 1 addition & 0 deletions crates/mcp-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
#![warn(missing_docs)]
#![warn(clippy::all)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::uninlined_format_args)]

pub mod client;
pub mod error;
Expand Down
8 changes: 4 additions & 4 deletions crates/mcp-core/src/messages/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl JsonRpcResponse {
{
match (&self.result, &self.error) {
(Some(result), None) => Ok(serde_json::from_value(result.clone())?),
(None, Some(error)) => Err(format!("JSON-RPC error: {}", error).into()),
(None, Some(error)) => Err(format!("JSON-RPC error: {error}").into()),
_ => Err("Invalid response: both result and error are present or missing".into()),
}
}
Expand Down Expand Up @@ -436,7 +436,7 @@ impl std::fmt::Display for JsonRpcError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "JSON-RPC Error {}: {}", self.code, self.message)?;
if let Some(data) = &self.data {
write!(f, " ({})", data)?;
write!(f, " ({data})")?;
}
Ok(())
}
Expand Down Expand Up @@ -486,8 +486,8 @@ impl From<i32> for RequestId {
impl std::fmt::Display for RequestId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::String(s) => write!(f, "{}", s),
Self::Number(n) => write!(f, "{}", n),
Self::String(s) => write!(f, "{s}"),
Self::Number(n) => write!(f, "{n}"),
Self::Null => write!(f, "null"),
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/mcp-core/src/messages/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ mod tests {

for (level, expected) in levels.iter().zip(expected.iter()) {
let json = serde_json::to_string(level).unwrap();
assert_eq!(json, format!("\"{}\"", expected));
assert_eq!(json, format!("\"{expected}\""));
assert_eq!(level.to_string(), *expected);
}
}
Expand Down
Loading