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
test(mcp): cover identifier normalization via module transform
Steven Enamakelfecfda89103a
diff --git a/crates/openhuman-core/src/mcp/module_client_tests.rs b/crates/openhuman-core/src/mcp/module_client_tests.rsindex a37b9011e7..82e808074b 100644--- a/crates/openhuman-core/src/mcp/module_client_tests.rs+++ b/crates/openhuman-core/src/mcp/module_client_tests.rs@@ -9,6 +9,7 @@ struct FakePort {calls: Arc<Mutex<Vec<(String, String, Value, bool)>>>,prepared_requests: Arc<Mutex<Vec<PrepareAgentToolsRequest>>>,validation_requests: Arc<Mutex<Vec<ValidateServerArgumentsRequest>>>,+ transform_requests: Arc<Mutex<Vec<tinymcp_bus::TransformTextRequest>>>,open_started: Arc<Notify>,close_started: Arc<Notify>,call_started: Arc<Notify>,@@ -159,6 +160,32 @@ impl McpModulePort for FakePort {self.validation_requests.lock().unwrap().push(request);Ok(ServerArgumentsValidation::Valid(arguments))}++ async fn transform_text(+ &self,+ request: tinymcp_bus::TransformTextRequest,+ ) -> Result<String, ModuleCallError> {+ self.transform_requests.lock().unwrap().push(request.clone());+ Ok(request.text)+ }+}++#[tokio::test]+async fn identifier_normalization_uses_tinymcp_root_transform_operation() {+ let port = FakePort::default();+ let requests = Arc::clone(&port.transform_requests);+ let client = client(port);++ let normalized = client.normalize_identifier("**search!**").await.unwrap();++ assert_eq!(normalized, "**search!**");+ let requests = requests.lock().unwrap();+ assert_eq!(requests.len(), 1);+ assert_eq!(+ requests[0].operation,+ tinymcp_bus::TextTransform::NormalizeIdentifier+ );+ assert_eq!(requests[0].text, "**search!**");}#[tokio::test]diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs b/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rsindex fc5cc8471d..e774007b8a 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp_target_tests.rs@@ -106,6 +106,13 @@ impl McpModulePort for PreparePort {_ => Err(crate::modules::client::ModuleCallError::ModuleFault),}}++ async fn transform_text(+ &self,+ request: tinymcp_bus::TransformTextRequest,+ ) -> Result<String, crate::modules::client::ModuleCallError> {+ Ok(request.text)+ }}#[tokio::test]diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs b/crates/openhuman-core/src/tools/impl/network/mcp_tests.rsindex 164111d371..a5c9e7e8f9 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp_tests.rs@@ -2,16 +2,16 @@ use super::*;use serde_json::json;#[test]-fn required_mcp_identifier_trims_model_punctuation() {+fn required_mcp_identifier_preserves_text_for_module_normalization() {let args = json!({ "server": " `docs`,", "tool": "**search!**" });- assert_eq!(required_string_arg(&args, "server").unwrap(), "docs");- assert_eq!(required_string_arg(&args, "tool").unwrap(), "search");+ assert_eq!(required_string_arg(&args, "server").unwrap(), "`docs`,");+ assert_eq!(required_string_arg(&args, "tool").unwrap(), "**search!**");}#[test]fn required_mcp_identifier_rejects_empty_values() {- for value in ["", " ", "```"] {+ for value in ["", " "] {let args = json!({ "server": value });assert!(required_string_arg(&args, "server").is_err());}