Skip to content

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

fix(registry): improve error logging and input validation in MCP ops

Steven Enamakelc6e41e018cd6
diff --git a/src/openhuman/mcp/registry/ops.rs b/src/openhuman/mcp/registry/ops.rs
index f2cacc24cb..9adb9a166c 100644
--- a/src/openhuman/mcp/registry/ops.rs
+++ b/src/openhuman/mcp/registry/ops.rs
@@ -490,7 +490,10 @@ pub async fn mcp_clients_list_tools(
.dynamic()
.list_tools(&server_id)
.await
- .map_err(|_| connect_first(&server_id))?;
+ .map_err(|error| {
+ tracing::debug!("[mcp-client] list_tools ({server_id}) failed: {error}");
+ connect_first(&server_id)
+ })?;
let tools = super::tools_safe_for_agent(&server_id, tools);
let count = tools.len();
@@ -552,9 +555,7 @@ pub async fn mcp_clients_config_assist(
user_message: String,
history: Option<Vec<ChatTurn>>,
) -> Result<RpcOutcome<Value>, String> {
- if qualified_name.trim().is_empty() {
- return Err("qualified_name must not be empty".to_string());
- }
+ let qualified_name = require(&qualified_name, "qualified_name")?;
tracing::debug!(
"[mcp-client] config_assist qualified_name={} message_len={}",
@@ -567,13 +568,13 @@ pub async fn mcp_clients_config_assist(
// surface and the approval gate.
let (detail, required_env_keys) = resolve(config)?
.dynamic()
- .config_assist(qualified_name.trim())
+ .config_assist(&qualified_name)
.await
.map_err(|error| format!("Failed to fetch registry detail: {error}"))?;
let system_prompt = build_config_assist_system_prompt(
&detail.display_name,
- qualified_name.trim(),
+ &qualified_name,
&required_env_keys,
);