Create a JSON response.
Automatically serializes the data with pretty-printing. Useful for returning structured data from tools.
The data to serialize as JSON
Optional
Optional formatting, annotations, and metadata
A CallToolResult with JSON text content
// Simple JSON responsereturn json({ status: 'ok', count: 42 });// Compact JSON (no indentation)return json(data, { indent: 0 }); Copy
// Simple JSON responsereturn json({ status: 'ok', count: 42 });// Compact JSON (no indentation)return json(data, { indent: 0 });
Create a JSON response.
Automatically serializes the data with pretty-printing. Useful for returning structured data from tools.