Function create_dual_response

Source
pub fn create_dual_response(data: &Value) -> CallToolResult
Expand description

Create a dual-format response containing both unstructured and structured content

This function creates responses that are compatible with:

  • Existing clients (accessing content[0].text for JSON string)
  • New clients expecting structured content (direct JSON field access)
  • Comprehensive test specifications requiring structured responses

§Arguments

  • data - The response data as a JSON Value

§Returns

A CallToolResult with both text content and structured content

§Examples

use serde_json::json;
use codeprism_mcp_server::response::create_dual_response;

let data = json!({
    "status": "success",
    "result": "analysis complete"
});

let response = create_dual_response(&data);
// Response contains both formats for maximum compatibility