Skip to content

chore: remove leftover prints for tracing statements - Fixes TUI apps using the SDK #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2025
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
2 changes: 1 addition & 1 deletion crates/rust-mcp-sdk/src/mcp_handlers/mcp_client_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub trait ClientHandler: Send + Sync + 'static {
runtime: &dyn McpClient,
) -> std::result::Result<(), RpcError> {
if !runtime.is_shut_down().await {
eprintln!("Process error: {}", error_message);
tracing::error!("Process error: {}", error_message);
}
Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub trait ClientHandlerCore: Send + Sync + 'static {
runtime: &dyn McpClient,
) -> std::result::Result<(), RpcError> {
if !runtime.is_shut_down().await {
eprintln!("Process error: {}", error_message);
tracing::error!("Process error: {}", error_message);
}
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-mcp-sdk/src/mcp_runtimes/client_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl McpClient for ClientRuntime {
break;
}
Err(e) => {
eprintln!("Error reading from std_err: {}", e);
tracing::error!("Error reading from std_err: {}", e);
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/rust-mcp-transport/src/client_sse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ where
// trim the trailing \n before making a request
let body = String::from_utf8_lossy(&data).trim().to_string();
if let Err(e) = http_post(&client_clone, &post_url, body, &custom_headers).await {
eprintln!("Failed to POST message: {:?}", e);
tracing::error!("Failed to POST message: {:?}", e);
}
},
None => break, // Exit if channel is closed
Expand Down
4 changes: 2 additions & 2 deletions crates/rust-mcp-transport/src/mcp_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ impl MCPStream {
//An error that is unrelated to a request.
tx.send(message).map_err(GenericSendError::new)?;
} else {
eprintln!(
"Error: Received response does not correspond to any request. {:?}",
tracing::warn!(
"Received response or error without a matching request: {:?}",
&message.is_response()
);
}
Expand Down
6 changes: 4 additions & 2 deletions crates/rust-mcp-transport/src/utils/sse_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl SseStream {
{
Ok(resp) => resp,
Err(e) => {
eprintln!("Failed to connect to SSE: {}", e);
tracing::error!("Failed to connect to SSE: {}", e);
if retry_count >= self.max_retries {
tracing::error!("Max retries reached, giving up");
if let Some(tx) = endpoint_event_tx.take() {
Expand Down Expand Up @@ -159,7 +159,9 @@ impl SseStream {
if !content.is_empty() {
let bytes = Bytes::copy_from_slice(content.as_bytes());
if self.read_tx.send(bytes).await.is_err() {
eprintln!("Readable stream closed, shutting down SSE task");
tracing::error!(
"Readable stream closed, shutting down SSE task"
);
if !endpoint_event_received {
if let Some(tx) = endpoint_event_tx.take() {
let _ = tx.send(None);
Expand Down
Loading