Skip to main content

format_rows_response

Function format_rows_response 

Source
fn format_rows_response(
    rows: Vec<Vec<Value>>,
    max_size: usize,
) -> Result<McpResult, McpRequestError>
Expand description

Serialize rows to JSON and enforce the response size cap.

If the serialized response exceeds max_size bytes, returns an error telling the agent to narrow its query. This mirrors how the HTTP SQL endpoint handles max_result_size in sql.rs — fail cleanly rather than silently truncating.