The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(mcp): route tool argument normalization through the module client
Steven Enamakel48eec02d6559
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rsindex eeb3a1371b..be7eba0f08 100644--- a/crates/openhuman-core/src/mcp/module_client.rs+++ b/crates/openhuman-core/src/mcp/module_client.rs@@ -18,7 +18,7 @@ use std::{use async_trait::async_trait;use serde::{de::DeserializeOwned, Serialize};-use serde_json::Value;+use serde_json::{Map, Value};use tinymcp_bus::{agent_tools::{McpToolPresentation, PrepareAgentToolsRequest},config::{McpClientConfig, OpenConfiguredRequest, OpenConfiguredResponse, TransitionStatus},@@ -372,6 +372,21 @@ impl McpConfiguredClient {.await}+ /// Normalizes host-supplied MCP arguments through TinyMCP's bounded+ /// implementation operation.+ pub(crate) async fn normalize_tool_arguments(+ &self,+ config: &McpClientConfig,+ arguments: Value,+ ) -> Result<Map<String, Value>, ModuleCallError> {+ self.call_confidential(+ config,+ names::methods::NORMALIZE_TOOL_ARGUMENTS,+ (Some(arguments),),+ )+ .await+ }+async fn call_inner<R: DeserializeOwned>(&self,config: &McpClientConfig,diff --git a/crates/openhuman-core/src/tools/impl/network/mcp.rs b/crates/openhuman-core/src/tools/impl/network/mcp.rsindex 7eda6fc672..15d14ba34b 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp.rs@@ -69,6 +69,7 @@ impl Tool for McpCallTool {.map_err(|_| anyhow::anyhow!("missing MCP tool identifier"))?;let client = McpConfiguredClient::for_config(&self.config).map_err(|_| anyhow::anyhow!("TinyMCP module is unavailable"))?;+ let client_config = host::client_config(&self.config);let prepared = client.prepare_agent_tools(tinymcp_bus::PrepareAgentToolsRequest {sources: vec![tinymcp_bus::McpToolSourceSpec {@@ -101,7 +102,9 @@ impl Tool for McpCallTool {.get("arguments").cloned().ok_or_else(|| anyhow::anyhow!("missing MCP tool arguments"))?;- let arguments = crate::normalize_tool_arguments(arguments)+ let arguments = client+ .normalize_tool_arguments(&client_config, arguments)+ .await.map_err(|_| anyhow::anyhow!("invalid MCP tool arguments"))?;Ok(Some(call.with_arguments(Value::Object(arguments))))}@@ -121,21 +124,6 @@ impl Tool for McpCallTool {.get("arguments").cloned().ok_or_else(|| anyhow::anyhow!("missing required `arguments` object"))?;- let arguments = match crate::normalize_tool_arguments(arguments) {- Ok(arguments) => Value::Object(arguments),- Err(error) => {- let outcome = tinymcp_bus::McpCallOutcome::failed(- &server,- &tool,- tinymcp_bus::McpCallError::new(tinymcp_bus::errors::INVALID_ARGUMENTS),- );- return Ok(with_outcome(- ToolResult::error(format!("`arguments`: {error}")),- &outcome,- ));- }- };-let client = match McpConfiguredClient::for_config(&self.config) {Ok(client) => client,Err(_) => {@@ -147,6 +135,23 @@ impl Tool for McpCallTool {}};let client_config = host::client_config(&self.config);+ let arguments = match client+ .normalize_tool_arguments(&client_config, arguments)+ .await+ {+ Ok(arguments) => Value::Object(arguments),+ Err(_) => {+ let outcome = tinymcp_bus::McpCallOutcome::failed(+ &server,+ &tool,+ tinymcp_bus::McpCallError::new(tinymcp_bus::errors::INVALID_ARGUMENTS),+ );+ return Ok(with_outcome(+ ToolResult::error("`arguments`: invalid MCP tool arguments"),+ &outcome,+ ));+ }+ };let call: tinymcp_bus::ClassifiedStaticToolCall = match client.call(&client_config,