render

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package render turns jade's typed responses into plain text for the MCP transport.

The consumer of every jade response is a language model, not a parser. MCP already delivers tool results as text content, so JSON is a serialization tax paid on every call: braces, quotes, repeated field names, indentation, and nulls for fields nobody populated. The 8.3 benchmark measured that tax at 5.63x shell's token cost across seven realistic questions, with roughly every response landing at 1,100-1,600 tokens regardless of how small the actual answer was.

Rendering happens at the transport boundary, so the internal structs stay typed and testable and only the wire format changes.

House style, applied by every renderer here:

  • the decisive content comes first, on the first line where possible;
  • empty, null and zero-valued fields are omitted entirely rather than serialized as evidence of their own absence;
  • source code is emitted as source code, not as a quoted string with escaped newlines;
  • structure appears only where a caller must branch on it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Text

func Text(value interface{}) (string, bool)

Text renders a known response type. The bool reports whether a renderer existed: false means the caller should fall back to JSON rather than inventing a format, so an unrendered type degrades to the old behavior instead of losing information.

Types

This section is empty.

Jump to

Keyboard shortcuts

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