Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(mcp): move debug logging from lifecycle to tool call sites

Steven Enamakelad466b526d9d
diff --git a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
index da3c43fc05..1c422d24ab 100644
--- a/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
+++ b/crates/openhuman-core/src/mcp/module_client/lifecycle.rs
@@ -17,17 +17,14 @@ impl McpConfiguredClient {
/// serialized by the client itself.
pub(crate) fn for_config(config: &Config) -> Result<Arc<Self>, ModuleCallError> {
if SHUTTING_DOWN.load(Ordering::Acquire) {
- eprintln!("debug MCP unavailable: shutting down");
crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
if !config.modules.enabled {
- eprintln!("debug MCP unavailable: modules disabled");
crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
if current_agent_context_is_removed() {
- eprintln!("debug MCP unavailable: agent context removed");
crate::modules::report::unavailable(MODULE);
return Err(ModuleCallError::Unavailable);
}
@@ -39,15 +36,12 @@ impl McpConfiguredClient {
.admit(&key, current_agent_context_is_removed, || {
Self::new(&data_dir, config).map(Arc::new)
})
- .map_err(|error| {
- eprintln!("debug MCP client admission error: {error:?}");
- match error {
+ .map_err(|error| match error {
AdmitError::Create(error) => error,
_ => {
crate::modules::report::unavailable(MODULE);
ModuleCallError::Unavailable
}
- }
})
}
diff --git a/crates/openhuman-core/src/tools/impl/network/mcp.rs b/crates/openhuman-core/src/tools/impl/network/mcp.rs
index 4c14d0357a..43752e2cd6 100644
--- a/crates/openhuman-core/src/tools/impl/network/mcp.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mcp.rs
@@ -179,7 +179,10 @@ impl Tool for McpListToolsTool {
let server = client
.normalize_identifier(&server)
.await
- .map_err(|error| anyhow::anyhow!(input_module_error_message(error)))?;
+ .map_err(|error| {
+ eprintln!("debug MCP normalize server failed: {error:?}");
+ anyhow::anyhow!(input_module_error_message(error))
+ })?;
let client_config = host::client_config(&self.config);
let remote: Vec<tinymcp_bus::McpRemoteTool> = match client
.call(
@@ -338,7 +341,10 @@ impl Tool for McpCallTool {
let tool = client
.normalize_identifier(&tool)
.await
- .map_err(|error| anyhow::anyhow!(input_module_error_message(error)))?;
+ .map_err(|error| {
+ eprintln!("debug MCP normalize tool failed: {error:?}");
+ anyhow::anyhow!(input_module_error_message(error))
+ })?;
let prepared = client
.prepare_agent_tools(tinymcp_bus::PrepareAgentToolsRequest {
sources: vec![tinymcp_bus::McpToolSourceSpec {
@@ -406,6 +412,7 @@ impl Tool for McpCallTool {
let server = match client.normalize_identifier(&server).await {
Ok(server) => server,
Err(error) => {
+ eprintln!("debug MCP normalize server failed: {error:?}");
let outcome = tinymcp_bus::McpCallOutcome::failed(
&server,
&tool,
@@ -420,6 +427,7 @@ impl Tool for McpCallTool {
let tool = match client.normalize_identifier(&tool).await {
Ok(tool) => tool,
Err(error) => {
+ eprintln!("debug MCP normalize tool failed: {error:?}");
let outcome = tinymcp_bus::McpCallOutcome::failed(
&server,
&tool,