pub fn json_content(json: Value) -> ValueExpand description
Helper to create a JSON content response
Creates a standard MCP JSON content response with structured data:
{
"content": [{
"type": "json",
"json": { ... }
}]
}Use case: Structured data for programmatic clients
§Example
ⓘ
fn handle_get_product(args: &Value) -> Result<Value, String> {
let product = get_product_from_db()?;
Ok(json_content(serde_json::to_value(product)?))
}