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): pin registry and action tool identities before the spec move
Steven Enamakelc1e814823c1b
diff --git a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rsindex 74a5b41c2f..d9ae6b1054 100644--- a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs+++ b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs@@ -109,3 +109,60 @@ async fn action_refuses_a_server_that_is_no_longer_connected() {assert!(result.is_error);assert!(result.text().contains("no longer connected"));}++/// The identity each action tool presents to the model, captured from the+/// hand-written adapter before its spec moved to `tinymcp_bus::agent_tools`.+///+/// Covers the paths that shape it: a remote name needing a slug, a blank+/// display name falling back to the qualified name, a missing description+/// falling back to the tool name, a non-object schema replaced, a schema+/// description sanitized, and the server-then-tool ordering.+#[test]+fn action_tools_present_the_exact_identity_they_always_had() {+ let mut first = server("server-1", "weather.forecast/current");+ first.tools[0].input_schema["properties"]["city"]["description"] =+ json!("City <|im_start|>name");+ first.tools.push(McpTool {+ name: "Plain".into(),+ description: None,+ input_schema: json!("not-object"),+ });+ let mut second = server("server-0", "forecast");+ second.display_name = " ".into();++ let tools = deferred_connected_tools(Arc::new(Config::default()), &[first, second]);++ let expected: [(&str, &str, &str); 3] = [+ (+ r#"mcp_forecast_183b86171ccb"#,+ r#"MCP server example/weather: Get the current weather forecast"#,+ r#"{"properties":{"city":{"type":"string"}},"required":["city"],"type":"object"}"#,+ ),+ (+ r#"mcp_plain_114702036e6f"#,+ r#"MCP server Weather Service: Plain"#,+ r#"{"properties":{},"type":"object"}"#,+ ),+ (+ r#"mcp_weather_forecast_current_f532d64694f1"#,+ r#"MCP server Weather Service: Get the current weather forecast"#,+ r#"{"properties":{"city":{"description":"City name","type":"string"}},"required":["city"],"type":"object"}"#,+ ),+ ];+ assert_eq!(tools.len(), expected.len());+ for (tool, (name, description, schema)) in tools.iter().zip(expected) {+ assert_eq!(tool.name(), name);+ assert_eq!(tool.description(), description, "{name}");+ assert_eq!(+ serde_json::to_string(&tool.parameters_schema()).unwrap(),+ schema,+ "{name}"+ );+ assert_eq!(tool.permission_level(), PermissionLevel::Execute);+ assert_eq!(tool.exposure(), ToolExposure::Deferred);+ assert!(tool.external_effect());+ assert_eq!(tool.category(), ToolCategory::Workflow);+ assert_eq!(tool.family(), Some("example/weather"));+ assert!(!tool.is_concurrency_safe(&json!({})));+ }+}diff --git a/crates/openhuman-core/src/mcp/registry/tools_tests.rs b/crates/openhuman-core/src/mcp/registry/tools_tests.rsindex 7c46c57b97..c15ff68665 100644--- a/crates/openhuman-core/src/mcp/registry/tools_tests.rs+++ b/crates/openhuman-core/src/mcp/registry/tools_tests.rs@@ -70,3 +70,136 @@ async fn list_tools_errors_for_unconnected_server() {"expected connect-first hint, got: {err}");}++/// The identity a registry tool presents to the model, captured from the+/// hand-written tools before their specs moved to `tinymcp_bus::agent_tools`.+///+/// Name, description and schema are prompt-cache and transcript identity: a+/// byte of drift invalidates every cached prefix and changes what a resumed+/// session replays. The schema is compared as serialized text, not as a+/// `Value`, so a key-order change is caught too.+struct Golden {+ tool: Box<dyn Tool>,+ name: &'static str,+ description: &'static str,+ schema: &'static str,+ permission: PermissionLevel,+ exposure: tinytools::ToolExposure,+ concurrency_safe: bool,+}++fn goldens() -> Vec<Golden> {+ vec![+ Golden {+ tool: Box::new(McpRegistrySearchTool::new(cfg())),+ name: r#"mcp_registry_search"#,+ description: r#"Search the MCP server registry catalog by `query`, optionally filtered by `transport` ("stdio" | "hosted" | "all"), paginated by `page` / `page_size`. Use to discover installable MCP servers."#,+ schema: r#"{"properties":{"page":{"minimum":1,"type":"integer"},"page_size":{"minimum":1,"type":"integer"},"query":{"type":"string"},"transport":{"enum":["stdio","hosted","all"],"type":"string"}},"type":"object"}"#,+ permission: PermissionLevel::ReadOnly,+ exposure: tinytools::ToolExposure::Deferred,+ concurrency_safe: true,+ },+ Golden {+ tool: Box::new(McpRegistryGetTool::new(cfg())),+ name: r#"mcp_registry_get"#,+ description: r#"Get one MCP registry server's detail by `qualified_name`."#,+ schema: r#"{"properties":{"qualified_name":{"type":"string"}},"required":["qualified_name"],"type":"object"}"#,+ permission: PermissionLevel::ReadOnly,+ exposure: tinytools::ToolExposure::Deferred,+ concurrency_safe: true,+ },+ Golden {+ tool: Box::new(McpRegistryInstalledListTool::new(cfg())),+ name: r#"mcp_registry_installed_list"#,+ description: r#"List the MCP servers currently installed for this user."#,+ schema: r#"{"properties":{},"type":"object"}"#,+ permission: PermissionLevel::ReadOnly,+ exposure: tinytools::ToolExposure::Deferred,+ concurrency_safe: true,+ },+ Golden {+ tool: Box::new(McpRegistryStatusTool::new(cfg())),+ name: r#"mcp_registry_status"#,+ description: r#"Report the connection status of installed MCP servers."#,+ schema: r#"{"properties":{},"type":"object"}"#,+ permission: PermissionLevel::ReadOnly,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: true,+ },+ Golden {+ tool: Box::new(McpRegistryListToolsTool::new(cfg())),+ name: r#"mcp_registry_list_tools"#,+ description: r#"List the tools (name, description, input schema) exposed by a connected MCP server, given its `server_id`. Use this to discover what a connected server can do before calling `mcp_registry_tool_call`. The server must already be connected (see `mcp_registry_status` / `mcp_registry_connect`)."#,+ schema: r#"{"properties":{"server_id":{"type":"string"}},"required":["server_id"],"type":"object"}"#,+ permission: PermissionLevel::ReadOnly,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: true,+ },+ Golden {+ tool: Box::new(McpRegistryConnectTool::new(cfg())),+ name: r#"mcp_registry_connect"#,+ description: r#"Connect (spawn + handshake) an installed MCP server by `server_id`, returning its tools."#,+ schema: r#"{"properties":{"server_id":{"type":"string"}},"required":["server_id"],"type":"object"}"#,+ permission: PermissionLevel::Execute,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: false,+ },+ Golden {+ tool: Box::new(McpRegistryDisconnectTool::new(cfg())),+ name: r#"mcp_registry_disconnect"#,+ description: r#"Disconnect (stop) a connected MCP server by `server_id`."#,+ schema: r#"{"properties":{"server_id":{"type":"string"}},"required":["server_id"],"type":"object"}"#,+ permission: PermissionLevel::Execute,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: false,+ },+ Golden {+ tool: Box::new(McpRegistryToolCallTool::new(cfg())),+ name: r#"mcp_registry_tool_call"#,+ description: r#"Invoke a tool on a connected MCP server: `server_id` + `tool_name` + `arguments` object."#,+ schema: r#"{"properties":{"arguments":{"type":"object"},"server_id":{"type":"string"},"tool_name":{"type":"string"}},"required":["server_id","tool_name"],"type":"object"}"#,+ permission: PermissionLevel::Execute,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: false,+ },+ Golden {+ tool: Box::new(McpRegistryUninstallTool::new(cfg())),+ name: r#"mcp_registry_uninstall"#,+ description: r#"Uninstall an installed MCP server by `server_id`. Default-OFF (opt-in)."#,+ schema: r#"{"properties":{"server_id":{"type":"string"}},"required":["server_id"],"type":"object"}"#,+ permission: PermissionLevel::Write,+ exposure: tinytools::ToolExposure::Direct,+ concurrency_safe: false,+ },+ ]+}++#[test]+fn registry_tools_present_the_exact_identity_they_always_had() {+ for golden in goldens() {+ let tool = &golden.tool;+ assert_eq!(tool.name(), golden.name);+ assert_eq!(tool.description(), golden.description, "{}", golden.name);+ assert_eq!(+ serde_json::to_string(&tool.parameters_schema()).unwrap(),+ golden.schema,+ "{}",+ golden.name+ );+ assert_eq!(+ tool.permission_level(),+ golden.permission,+ "{}",+ golden.name+ );+ assert_eq!(tool.exposure(), golden.exposure, "{}", golden.name);+ assert_eq!(+ tool.is_concurrency_safe(&json!({})),+ golden.concurrency_safe,+ "{}",+ golden.name+ );+ assert!(!tool.external_effect(), "{}", golden.name);+ assert_eq!(tool.family(), None, "{}", golden.name);+ }+}