MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / extract_text

Function extract_text

tests/mcp_suite/mcp_handler_test.rs:725–729  ·  view source on GitHub ↗

Extracts the text content from a `ToolResult` value (the standard `content[0].text` envelope).

(value: &Value)

Source from the content-addressed store, hash-verified

723/// Extracts the text content from a `ToolResult` value (the standard
724/// `content[0].text` envelope).
725fn extract_text(value: &Value) -> &str {
726 value["content"][0]["text"]
727 .as_str()
728 .unwrap_or("<missing text>")
729}
730
731fn extract_json(value: &Value) -> Value {
732 serde_json::from_str(extract_text(value)).unwrap()

Calls 1

as_strMethod · 0.45

Tested by

no test coverage detected