Skip to content

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

refactor(mcp-ui): share the installed-tool lookup with the widget port

oxoxDev02fa1a6bf8df
diff --git a/crates/openhuman-core/src/mcp/ui/port.rs b/crates/openhuman-core/src/mcp/ui/port.rs
index d2c1505396..2fceba17a3 100644
--- a/crates/openhuman-core/src/mcp/ui/port.rs
+++ b/crates/openhuman-core/src/mcp/ui/port.rs
@@ -112,16 +112,8 @@ impl UiServerPort for HostUiPort {
let client = self.client()?;
let client_config = host::client_config(&self.config);
if self.is_installed_connected(server_id).await {
- let live: Vec<tinymcp_bus::McpTool> = client
- .call(
- &client_config,
- tinymcp_bus::names::methods::LIST_TOOLS,
- (server_id,),
- )
- .await
- .ok()?;
- let safe = crate::mcp::registry::tools_safe_for_agent(server_id, live);
- let candidate = safe.into_iter().find(|candidate| candidate.name == tool)?;
+ let candidate =
+ super::decorate::installed_tool(&client, &client_config, server_id, tool).await?;
return Some(UiToolDescriptor {
meta: candidate.meta,
annotations: None,
diff --git a/crates/openhuman-core/src/mcp/ui/port_tests.rs b/crates/openhuman-core/src/mcp/ui/port_tests.rs
index b23918681d..29f5da3534 100644
--- a/crates/openhuman-core/src/mcp/ui/port_tests.rs
+++ b/crates/openhuman-core/src/mcp/ui/port_tests.rs
@@ -232,4 +232,16 @@ mod module_backed {
Some(json!({"ui": {"resourceUri": "ui://card"}}))
);
}
+
+ #[tokio::test]
+ async fn a_tool_the_server_does_not_list_has_no_descriptor() {
+ let fake = Arc::new(ModulePort {
+ installed: vec!["srv-1"],
+ ..ModulePort::default()
+ });
+ assert!(port_over(&fake)
+ .tool_descriptor("srv-1", "missing")
+ .await
+ .is_none());
+ }
}