Skip to content

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

fix(mcp): validate server and tool identifiers before calling

Steven Enamakel2d95944c98ea
diff --git a/crates/openhuman-core/src/tools/impl/network/mcp.rs b/crates/openhuman-core/src/tools/impl/network/mcp.rs
index 07a0709b63..c25cf8b1ea 100644
--- a/crates/openhuman-core/src/tools/impl/network/mcp.rs
+++ b/crates/openhuman-core/src/tools/impl/network/mcp.rs
@@ -403,6 +403,34 @@ impl Tool for McpCallTool {
));
}
};
+ let server = match client.normalize_identifier(&server).await {
+ Ok(server) => server,
+ Err(_) => {
+ let outcome = tinymcp_bus::McpCallOutcome::failed(
+ &server,
+ &tool,
+ tinymcp_bus::McpCallError::new(tinymcp_bus::errors::INVALID_ARGUMENTS),
+ );
+ return Ok(with_outcome(
+ ToolResult::error("MCP server or tool identifier is invalid"),
+ &outcome,
+ ));
+ }
+ };
+ let tool = match client.normalize_identifier(&tool).await {
+ Ok(tool) => tool,
+ Err(_) => {
+ let outcome = tinymcp_bus::McpCallOutcome::failed(
+ &server,
+ &tool,
+ tinymcp_bus::McpCallError::new(tinymcp_bus::errors::INVALID_ARGUMENTS),
+ );
+ return Ok(with_outcome(
+ ToolResult::error("MCP server or tool identifier is invalid"),
+ &outcome,
+ ));
+ }
+ };
let client_config = host::client_config(&self.config);
let arguments = match client.normalize_tool_arguments(arguments).await {
Ok(arguments) => Value::Object(arguments),