Skip to main content

extract_tool_content

Function extract_tool_content 

Source
pub fn extract_tool_content(result: &Value) -> String
Expand description

Extract the model-facing content from an MCP tools/call result.

Concatenates the text of every text content block; non-text blocks (image, resource, …) are rendered as [<type> content] placeholders so the model knows something was returned without flooding the context with base64. Falls back to pretty-printed JSON when there’s no content array.