Skip to content

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

fix(mcp): name installed-server tools with tinymcp's server-scoped digest

Steven Enamakel96e44db85808
diff --git a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
index bb9d7d4701..9f03b880c8 100644
--- a/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
+++ b/crates/openhuman-core/src/agent/session_host/runtime_session_tests.rs
@@ -175,7 +175,7 @@ fn connected_mcp_actions_enter_search_and_leave_on_disconnect() {
}],
}];
- let action = searchable_name("example/weather", "forecast");
+ let action = searchable_name("server-1", "example/weather", "forecast");
prelude.refresh_delegation_tool_surface();
assert!(prelude.synthesized_tool_names_for_test().contains(&action));
{
diff --git a/crates/openhuman-core/src/mcp/registry/action_tool.rs b/crates/openhuman-core/src/mcp/registry/action_tool.rs
index f85b7ec100..f566d3820b 100644
--- a/crates/openhuman-core/src/mcp/registry/action_tool.rs
+++ b/crates/openhuman-core/src/mcp/registry/action_tool.rs
@@ -32,12 +32,13 @@ use super::types::ConnectedServerOverview;
/// The name an installed server's tool is exposed under.
///
-/// `mcp_<server>_<tool>`, from the server's qualified name; see
-/// `tinymcp::tools::naming`. Only the first of two colliding tools gets this
-/// exact name — [`deferred_connected_tools`] disambiguates the second.
+/// `mcp_<server>_<tool>_<digest>`: the server part from its qualified name,
+/// plus a short digest of the install and tool so the name never changes
+/// when another server with the same slug comes or goes; see
+/// `tinymcp::tools::naming`.
#[must_use]
-pub fn searchable_name(qualified_name: &str, tool_name: &str) -> String {
- tinymcp::tools::naming::tool_name(qualified_name, tool_name)
+pub fn searchable_name(server_id: &str, qualified_name: &str, tool_name: &str) -> String {
+ tinymcp::tools::naming::disambiguated_tool_name(server_id, qualified_name, tool_name)
}
/// One deferred tool per action of each installed server in `servers`.
diff --git a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
index 175b284135..fe07403864 100644
--- a/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
+++ b/crates/openhuman-core/src/mcp/registry/action_tool_tests.rs
@@ -24,11 +24,18 @@ fn server(server_id: &str, tool_name: &str) -> ConnectedServerOverview {
#[test]
fn names_read_as_server_then_tool_and_are_provider_safe() {
- let name = searchable_name("example/weather", "weather.forecast/current");
- assert_eq!(name, "mcp_weather_weather_forecast_current");
+ let name = searchable_name("server-1", "example/weather", "weather.forecast/current");
+ assert!(
+ name.starts_with("mcp_weather_weather_forecast_current_"),
+ "{name}"
+ );
assert_eq!(
name,
- searchable_name("example/weather", "weather.forecast/current")
+ searchable_name("server-1", "example/weather", "weather.forecast/current")
+ );
+ assert_ne!(
+ name,
+ searchable_name("server-2", "example/weather", "weather.forecast/current")
);
assert!(name.len() <= 64);
assert!(name
@@ -42,7 +49,11 @@ fn tools_are_named_mcp_server_tool() {
Arc::new(Config::default()),
&[server("server-1", "readGoals")],
);
- assert_eq!(tools[0].name(), "mcp_weather_read_goals");
+ assert_eq!(
+ tools[0].name(),
+ searchable_name("server-1", "example/weather", "readGoals")
+ );
+ assert!(tools[0].name().starts_with("mcp_weather_read_goals_"));
}
#[test]
@@ -68,7 +79,8 @@ fn a_recorded_legacy_name_is_restored_as_an_alias() {
&recorded,
);
let names: Vec<&str> = tools.iter().map(|tool| tool.name()).collect();
- assert_eq!(names, ["mcp_weather_forecast", legacy.as_str()]);
+ let current = searchable_name("server-1", "example/weather", "forecast");
+ assert_eq!(names, [current.as_str(), legacy.as_str()]);
let none = deferred_connected_tools_with_legacy(
Arc::new(Config::default()),
diff --git a/tests/agent_harness_e2e.rs b/tests/agent_harness_e2e.rs
index e018b6da21..22c8ee42de 100644
--- a/tests/agent_harness_e2e.rs
+++ b/tests/agent_harness_e2e.rs
@@ -4042,9 +4042,12 @@ async fn orchestrator_calls_a_connected_mcp_tool_directly_inner() {
reset_script(Vec::new());
let stack = boot_stack().await;
// Connecting also writes the tool cache the orchestrator's surface reads.
- declare_and_connect_registry_echo_server(&stack.rpc_base, 940).await;
- let action =
- openhuman_core::mcp::registry::action_tool::searchable_name(REGISTRY_MCP_SERVER, "echo");
+ let server_id = declare_and_connect_registry_echo_server(&stack.rpc_base, 940).await;
+ let action = openhuman_core::mcp::registry::action_tool::searchable_name(
+ &server_id,
+ REGISTRY_MCP_SERVER,
+ "echo",
+ );
reset_script(vec![
tool_call_completion(