Skip to main content

text_content

Function text_content 

Source
pub fn text_content(text: impl Into<String>) -> Value
Expand description

Helper to create a text content response

Creates a standard MCP text content response:

{
  "content": [{
    "type": "text",
    "text": "your text here"
  }]
}

§Example

fn handle_get_price(args: &Value) -> Result<Value, String> {
    let price = 29.99;
    Ok(text_content(format!("Price: ${:.2}", price)))
}