Skip to content

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

test(gitbooks): cover endpoint redaction and module result mapping

Steven Enamakel39caf3a280c5
diff --git a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
index 70e40796a5..1c5290c485 100644
--- a/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/network/gitbooks_tests.rs
@@ -181,6 +181,40 @@ fn redact_endpoint_keeps_only_origin() {
redact_endpoint("http://example.com:8080/path?token=secret"),
"http://example.com:8080"
);
+ assert_eq!(
+ redact_endpoint("https://user:[email protected]/path?token=secret"),
+ "<redacted>"
+ );
+ assert_eq!(redact_endpoint("file:///private/path"), "<redacted>");
+}
+
+#[test]
+fn module_rendered_results_preserve_text_json_error_and_markdown() {
+ let result = map_module_rendered_result(tinymcp_bus::McpToolResult {
+ content: vec![
+ tinymcp_bus::McpToolContent::Text {
+ text: "plain excerpt".to_owned(),
+ },
+ tinymcp_bus::McpToolContent::Json {
+ data: json!({"title": "Guide", "rank": 1}),
+ },
+ ],
+ is_error: true,
+ markdown_formatted: Some("**formatted excerpt**".to_owned()),
+ ..Default::default()
+ });
+
+ assert!(result.is_error);
+ assert_eq!(result.markdown_formatted.as_deref(), Some("**formatted excerpt**"));
+ assert_eq!(result.content.len(), 2);
+ assert!(matches!(
+ &result.content[0],
+ tinytools::ToolContent::Text { text } if text == "plain excerpt"
+ ));
+ assert!(matches!(
+ &result.content[1],
+ tinytools::ToolContent::Json { data } if data == &json!({"title": "Guide", "rank": 1})
+ ));
}
#[tokio::test]