Skip to content

Function: toDescription()

toDescription(node): string

Format a nested description tree as a Markdown-ish string suitable for an LLM system prompt, Zod .describe() block, Mastra tool description, or any other long-form text destination.

Every string section is dedented (common leading whitespace stripped), right-trimmed line by line, and freed of leading / trailing blank lines, so callers can write multi-line template literals indented naturally in source without leaking that indentation into the consumer-facing output. Plain-string inputs flow through unchanged apart from the same normalization pass, so a single multi-line template literal works directly:

toDescription(`
Ask the Genie space "${alias}" a question.
Pass the answer through as-is.
`);
// Ask the Genie space "default" a question.
// Pass the answer through as-is.
toDescription([
`
Ask the Genie space a question.
Phrase it from the user's perspective.
`,
{ bullets: [
["Pass the answer through as-is", { numbered: ["item", "item"] }],
]},
{ Instructions: "Reply with the SQL only." },
]);
// Ask the Genie space a question.
// Phrase it from the user's perspective.
// - Pass the answer through as-is
// 1. item
// 2. item
//
// Instructions:
//
// Reply with the SQL only.

See Description for the node grammar.

Description

string