Skip to content

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

feat(mcp): add prepare_agent_tools to module client

Steven Enamakelc35f2a4bf5c4
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index 2c179878b2..1f1a8aee20 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -20,6 +20,7 @@ use async_trait::async_trait;
use serde::{de::DeserializeOwned, Serialize};
use serde_json::Value;
use tinymcp_bus::{
+ agent_tools::{McpToolPresentation, PrepareAgentToolsRequest},
config::{McpClientConfig, OpenConfiguredRequest, OpenConfiguredResponse, TransitionStatus},
names, SupervisorBatch,
};
@@ -84,6 +85,11 @@ pub(crate) trait McpModulePort: Send + Sync {
args: Value,
confidential: bool,
) -> Result<Value, ModuleCallError>;
+
+ async fn prepare_agent_tools(
+ &self,
+ request: PrepareAgentToolsRequest,
+ ) -> Result<Vec<McpToolPresentation>, ModuleCallError>;
}
struct TinyMcpPort {
@@ -150,6 +156,19 @@ impl McpModulePort for TinyMcpPort {
Err(ModuleCallError::Unavailable)
}
}
+
+ async fn prepare_agent_tools(
+ &self,
+ request: PrepareAgentToolsRequest,
+ ) -> Result<Vec<McpToolPresentation>, ModuleCallError> {
+ self.root
+ .call(
+ MODULE,
+ names::methods::PREPARE_AGENT_TOOLS,
+ (request,),
+ )
+ .await
+ }
}
/// One workspace's serialized TinyMCP lifecycle and private object proxy.
@@ -325,6 +344,19 @@ impl McpConfiguredClient {
self.call_inner(config, member, args, true).await
}
+ /// Asks the module to prepare owner-derived names and rule facts for
+ /// host-screened tools. This root operation needs no configured server
+ /// object or credentials.
+ pub(crate) async fn prepare_agent_tools(
+ &self,
+ request: PrepareAgentToolsRequest,
+ ) -> Result<Vec<McpToolPresentation>, ModuleCallError> {
+ if SHUTTING_DOWN.load(Ordering::Acquire) {
+ return Err(ModuleCallError::Unavailable);
+ }
+ self.port.prepare_agent_tools(request).await
+ }
+
async fn call_inner<R: DeserializeOwned>(
&self,
config: &McpClientConfig,