Documentation
¶
Overview ¶
Package render produces text renderings of tool results for MCP clients.
Index ¶
- Constants
- func IsLegalFormat(format string) bool
- func JSONValue(v any) string
- func RenderKV(title string, records []map[string]any) string
- func RenderMessagesBlock(messages []string) string
- func RenderTable(rows []map[string]any) string
- func RenderTableWithMessages(rows []map[string]any, messages []string) string
- func UnwrapRows(rows []map[string]any) []map[string]any
Constants ¶
const ( FormatMarkdown = "markdown" FormatJSON = "json" )
Text content render formats (issue #669). Markdown is the historical default; JSON renders the same DTO carried in structuredContent as compact JSON so text-only MCP consumers get a machine-readable payload.
Variables ¶
This section is empty.
Functions ¶
func IsLegalFormat ¶ added in v0.10.542
IsLegalFormat reports whether the supplied format name is supported. The empty string is legal and means "use the default".
func JSONValue ¶ added in v0.10.542
JSONValue renders any value as compact JSON for text content. Row sets pass through UnwrapRows first so database/sql nullable wrappers serialise as their scalar payloads rather than {Valid, ...} envelopes.
func RenderMessagesBlock ¶ added in v1.1.959
RenderMessagesBlock renders engine-emitted per-statement messages (eg upstream provider diagnostics) as a labelled markdown block. Empty input renders as "" so statements without messages produce unchanged output.
func RenderTable ¶
RenderTable renders a uniform multi-row result set as a markdown table. Column order is stable: the union of keys across all rows, sorted alphabetically.
func RenderTableWithMessages ¶ added in v1.1.959
RenderTableWithMessages renders rows exactly as RenderTable does, appending a labelled messages block when the statement produced engine messages.
Types ¶
This section is empty.