render

package
v0.10.557 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package render produces text renderings of tool results for MCP clients.

Index

Constants

View Source
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

func IsLegalFormat(format string) bool

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

func JSONValue(v any) string

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 RenderKV

func RenderKV(title string, records []map[string]any) string

RenderKV renders sparse / single-record / mixed-shape results as labelled records.

func RenderTable

func RenderTable(rows []map[string]any) string

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 UnwrapRows added in v0.10.542

func UnwrapRows(rows []map[string]any) []map[string]any

UnwrapRows returns a copy of `rows` with database/sql nullable wrappers collapsed to their scalar payloads (see unwrap).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL