Documentation
¶
Overview ¶
Package format provides output format conversion for MCP tool call results. Supported formats: TOON (Token-Oriented Object Notation), CSV, JSON, and text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format converts a parsed JSON value to the specified output format. Supported formats: "json" (compact), "toon" (TOON v3.0), "csv" (RFC 4180), "text" (passthrough). Returns an error for unsupported formats or conversion failures.
func ToCSV ¶
ToCSV converts a parsed JSON value to CSV format. The input must be an array of objects ([]any of map[string]any). Headers are derived from the first object's keys in sorted order. Returns an error if the data is not tabular.
func ToTOON ¶
ToTOON converts a parsed JSON value to TOON v3.0 notation. TOON is a compact, LLM-readable format that reduces token consumption compared to JSON while preserving structural information.
func TruncateResult ¶
TruncateResult truncates result to at most maxBytes, trimming at a UTF-8 rune boundary. If result is at or under maxBytes, it is returned unchanged and wasTruncated is false. If maxBytes <= 0, the result is returned unchanged.
Types ¶
This section is empty.