Skip to content

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

feat(mcp): add text transform and identifier normalization

Steven Enamakel9f0d7aa8b88d
diff --git a/crates/openhuman-core/src/mcp/module_client.rs b/crates/openhuman-core/src/mcp/module_client.rs
index dd98a987a3..9ed66a32e5 100644
--- a/crates/openhuman-core/src/mcp/module_client.rs
+++ b/crates/openhuman-core/src/mcp/module_client.rs
@@ -104,6 +104,14 @@ pub(crate) trait McpModulePort: Send + Sync {
) -> Result<Map<String, Value>, ModuleCallError> {
Err(ModuleCallError::IncompatibleContract)
}
+
+ /// Applies a TinyMCP-owned text transformation through the root operation.
+ async fn transform_text(
+ &self,
+ _request: tinymcp_bus::TransformTextRequest,
+ ) -> Result<String, ModuleCallError> {
+ Err(ModuleCallError::IncompatibleContract)
+ }
}
struct TinyMcpPort {
@@ -205,6 +213,15 @@ impl McpModulePort for TinyMcpPort {
)
.await
}
+
+ async fn transform_text(
+ &self,
+ request: tinymcp_bus::TransformTextRequest,
+ ) -> Result<String, ModuleCallError> {
+ self.root
+ .call_confidential(MODULE, names::methods::TRANSFORM_TEXT, (request,))
+ .await
+ }
}
/// One workspace's serialized TinyMCP lifecycle and private object proxy.
@@ -434,6 +451,23 @@ impl McpConfiguredClient {
self.port.normalize_tool_arguments(Some(arguments)).await
}
+ /// Normalizes a model-supplied MCP identifier in TinyMCP.
+ pub(crate) async fn normalize_identifier(
+ &self,
+ value: &str,
+ ) -> Result<String, ModuleCallError> {
+ if SHUTTING_DOWN.load(Ordering::Acquire) {
+ return Err(ModuleCallError::Unavailable);
+ }
+ self.port
+ .transform_text(tinymcp_bus::TransformTextRequest {
+ operation: tinymcp_bus::TextTransform::NormalizeIdentifier,
+ text: value.to_owned(),
+ max_bytes: tinymcp_bus::MAX_PROCESSING_BYTES,
+ })
+ .await
+ }
+
/// Loads and prepares configured-server tools from TinyMCP's persistent
/// cache, listing a server only when no cached catalog exists. The host
/// applies its prompt-injection filter before TinyMCP creates the stable