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 validate_server_arguments in module port fakes
Steven Enamakel908b54d6aca9
diff --git a/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs b/crates/openhuman-core/src/mcp/registry/config_ops_tests.rsindex d5c9b3be42..5025790e39 100644--- a/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs+++ b/crates/openhuman-core/src/mcp/registry/config_ops_tests.rs@@ -4,7 +4,10 @@ use crate::modules::client::ModuleCallError;use async_trait::async_trait;use serde_json::Value;use std::sync::{Arc, Mutex};-use tinymcp_bus::{OpenConfiguredResponse, TransitionStatus};+use tinymcp_bus::{+ OpenConfiguredResponse, ServerArgumentsValidation, TransitionStatus,+ ValidateServerArgumentsRequest,+};#[derive(Clone, Default)]struct ConfigDocumentPort {@@ -73,6 +76,13 @@ impl McpModulePort for ConfigDocumentPort {) -> Result<Vec<tinymcp_bus::McpToolPresentation>, ModuleCallError> {Ok(Vec::new())}++ async fn validate_server_arguments(+ &self,+ _: ValidateServerArgumentsRequest,+ ) -> Result<ServerArgumentsValidation, ModuleCallError> {+ std::future::ready(Err(ModuleCallError::IncompatibleContract)).await+ }}fn config(workspace: &tempfile::TempDir) -> Config {diff --git a/crates/openhuman-core/src/mcp/registry/ops_tests.rs b/crates/openhuman-core/src/mcp/registry/ops_tests.rsindex 9882204095..ec33a49483 100644--- a/crates/openhuman-core/src/mcp/registry/ops_tests.rs+++ b/crates/openhuman-core/src/mcp/registry/ops_tests.rs@@ -11,7 +11,10 @@ use crate::modules::client::ModuleCallError;use async_trait::async_trait;use serde_json::Value;use std::sync::{Arc, Mutex};-use tinymcp_bus::{OpenConfiguredResponse, TransitionStatus};+use tinymcp_bus::{+ OpenConfiguredResponse, ServerArgumentsValidation, TransitionStatus,+ ValidateServerArgumentsRequest,+};#[test]fn a_blank_identifier_is_refused_with_the_field_name() {@@ -127,6 +130,13 @@ impl McpModulePort for RegistryPort {) -> Result<Vec<tinymcp_bus::McpToolPresentation>, ModuleCallError> {Ok(Vec::new())}++ async fn validate_server_arguments(+ &self,+ _: ValidateServerArgumentsRequest,+ ) -> Result<ServerArgumentsValidation, ModuleCallError> {+ std::future::ready(Err(ModuleCallError::IncompatibleContract)).await+ }}fn status(server_id: &str, qualified_name: &str) -> tinymcp_bus::ConnStatus {diff --git a/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs b/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rsindex 4e41d9fe03..d9b3849147 100644--- a/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs+++ b/crates/openhuman-core/src/tools/impl/network/mcp_server_tools.rs@@ -16,16 +16,22 @@//! definitions, and the secret scrubber on output, exactly as `mcp_call_tool`//! applies them.-use std::collections::HashSet;use std::sync::Arc;use async_trait::async_trait;use serde_json::Value;+#[cfg(test)]+use std::collections::HashSet;+#[cfg(test)]use tinymcp::tools::{McpExposure, McpServerTool, McpToolInvoker, McpToolSource, SecretScrubber};+#[cfg(test)]use tinymcp::McpRemoteToolExt;use tinytools::{PermissionLevel, Tool, ToolCategory, ToolExposure, ToolResult};-use crate::config::{Config, McpToolExposure};+use crate::config::Config;+#[cfg(test)]+use crate::config::McpToolExposure;+#[cfg(test)]use crate::mcp::config_servers::McpServerRegistry;use crate::security::{SecurityPolicy, ToolOperation};@@ -180,6 +186,7 @@ impl Tool for ModuleConfiguredMcpServerTool {////// `reserved` names are never produced — the generic bridge tools and/// anything else already registered keep their names.+#[cfg(test)]pub fn configured_server_tools(config: &Config,registry: &Arc<McpServerRegistry>,@@ -238,6 +245,7 @@ pub fn configured_server_tools(}/// The exposure `config` asks for on the server named `server`.+#[cfg(test)]fn exposure_for(config: &Config, server: &str) -> McpExposure {let Some(declared) = config.mcp_client@@ -257,6 +265,7 @@ fn exposure_for(config: &Config, server: &str) -> McpExposure {}/// Lists and caches `servers` off the tool-assembly path.+#[cfg(test)]fn warm_in_background(host: Arc<crate::mcp::host::McpHost>,registry: Arc<McpServerRegistry>,@@ -287,6 +296,7 @@ fn warm_in_background(}/// A configured server's tool under this application's call policy.+#[cfg(test)]pub struct ConfiguredMcpServerTool {inner: McpServerTool,registry: Arc<McpServerRegistry>,@@ -296,6 +306,7 @@ pub struct ConfiguredMcpServerTool {workspace_dir: std::path::PathBuf,}+#[cfg(test)]impl ConfiguredMcpServerTool {fn new(inner: McpServerTool,@@ -317,6 +328,7 @@ impl ConfiguredMcpServerTool {}#[async_trait]+#[cfg(test)]impl Tool for ConfiguredMcpServerTool {fn name(&self) -> &str {self.inner.name()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 953a88499e..1fecc9748f 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@@ -7,9 +7,10 @@ use std::{use crate::mcp::module_client::{McpConfiguredClient, McpModulePort};use async_trait::async_trait;-use serde_json::{Value, json};+use serde_json::{json, Value};use tinymcp_bus::{- McpToolPresentation, OpenConfiguredResponse, PrepareAgentToolsRequest, TransitionStatus,+ McpToolPresentation, OpenConfiguredResponse, PrepareAgentToolsRequest,+ ServerArgumentsValidation, TransitionStatus, ValidateServerArgumentsRequest,};#[derive(Clone, Default)]@@ -81,6 +82,16 @@ impl McpModulePort for PreparePort {}).collect())}++ async fn validate_server_arguments(+ &self,+ _: ValidateServerArgumentsRequest,+ ) -> Result<ServerArgumentsValidation, crate::modules::client::ModuleCallError> {+ std::future::ready(Err(+ crate::modules::client::ModuleCallError::IncompatibleContract,+ ))+ .await+ }}#[tokio::test]diff --git a/crates/openhuman-core/src/tools/impl/network/mod.rs b/crates/openhuman-core/src/tools/impl/network/mod.rsindex ae2263f405..e6a5854d13 100644--- a/crates/openhuman-core/src/tools/impl/network/mod.rs+++ b/crates/openhuman-core/src/tools/impl/network/mod.rs@@ -26,6 +26,8 @@ pub use host::{http_request_tool, web_fetch_tool};#[cfg(feature = "mcp")]pub use mcp::{mcp_call_tool, McpListServersTool, McpListToolsTool};#[cfg(feature = "mcp")]+pub use mcp_server_tools::configured_server_tools_from_presentations;+#[cfg(all(feature = "mcp", test))]pub use mcp_server_tools::{configured_server_tools, ConfiguredMcpServerTool};/// Shared test helper for the network tools' local-only enforcement tests