pub fn multi_content(items: Vec<Value>) -> ValueExpand description
Helper to create a multi-content response
Creates a response with multiple content items (text, images, resources):
{
"content": [
{"type": "text", "text": "..."},
{"type": "image", "data": "...", "mimeType": "..."},
{"type": "resource", "uri": "..."}
]
}§Example
ⓘ
fn handle_get_product(args: &Value) -> Result<Value, String> {
Ok(multi_content(vec![
serde_json::json!({"type": "text", "text": "Product info"}),
serde_json::json!({
"type": "image",
"data": base64_image,
"mimeType": "image/jpeg"
})
]))
}