render

package
v1.1.975 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 5 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 RenderMessagesBlock added in v1.1.959

func RenderMessagesBlock(messages []string) string

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

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 RenderTableWithMessages added in v1.1.959

func RenderTableWithMessages(rows []map[string]any, messages []string) string

RenderTableWithMessages renders rows exactly as RenderTable does, appending a labelled messages block when the statement produced engine messages.

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