/** * Message template system for cdp-tools * * Loads and formats user-facing messages from docs/messages.md */ interface MessageTemplate { id: string; type: 'error' | 'success' | 'warning' | 'info' | 'list'; code?: string; summary?: string; content: string; suggestions?: string[]; note?: string; example?: string; } declare class MessageManager { private messages; private loaded; /** * Load messages from docs/messages.md */ private loadMessages; /** * Parse messages from markdown content */ private parseMessages; /** * Load fallback messages if markdown file can't be loaded */ private loadFallbackMessages; /** * Get a message by ID with variable substitution */ getMessage(id: string, variables?: Record): string; /** * Get a complete message template with metadata */ getMessageTemplate(id: string): MessageTemplate | undefined; /** * Format an error message with suggestions and examples * Uses the same Status + Key detail format as getFormattedResponse */ getErrorMessage(id: string, variables?: Record): string; /** * Resolve a dotted path to a value in the variables object */ private resolveVariable; /** * Format a message template with variable substitution * Supports: * - {{variable}} - simple substitution * - {{object.property}} - nested access * - {{#variable}}...{{/variable}} - conditional (truthy) * - {{^variable}}...{{/variable}} - inverted conditional (falsy) * - {{#if condition}}...{{/if}} - explicit if blocks * - {{#each array}}...{{/each}} - iteration over arrays */ private formatMessage; /** * Process conditionals within a given context (used by #each) */ private processConditionals; /** * Get message code for error responses */ getMessageCode(id: string): string | undefined; /** * Check if a message exists */ hasMessage(id: string): boolean; /** * Format data as a JSON code block */ formatCodeBlock(data: any, language?: string): string; /** * Format an array as a markdown bullet list */ formatList(items: string[]): string; /** * Get a complete markdown-only response for a tool * Combines message template with optional data formatting * * Output format: * Line 1: Status line (Success/Error/Warning/Info: Brief description) * Line 2: Key detail (most important info like location, ID, count) * Line 3+: Additional content (suggestions, notes, data) */ getFormattedResponse(id: string, variables?: Record, data?: any): string; } export declare const messages: MessageManager; /** * Helper function to get a formatted message */ export declare function getMessage(id: string, variables?: Record): string; /** * Helper function to get a formatted error message with suggestions */ export declare function getErrorMessage(id: string, variables?: Record): string; /** * Helper function to get message code */ export declare function getMessageCode(id: string): string | undefined; /** * Helper function to get a complete markdown-only response */ export declare function getFormattedResponse(id: string, variables?: Record, data?: any): string; /** * Helper function to format data as a code block */ export declare function formatCodeBlock(data: any, language?: string): string; /** * Helper function to format an array as a markdown list */ export declare function formatList(items: string[]): string; import type { ToolResponseMeta } from './tool-response.js'; /** * MCP Response type */ interface MCPResponse { content: Array<{ type: 'text'; text: string; }>; isError?: boolean; /** Structured metadata for programmatic use (validation, replay). Decoupled from text output. */ _meta?: ToolResponseMeta; } /** * Create an error response in MCP format with markdown content */ export declare function createErrorResponse(messageId: string, variables?: Record): MCPResponse; /** * Create a success response in MCP format with markdown content */ export declare function createSuccessResponse(messageId: string, variables?: Record, data?: any): MCPResponse; /** * Format a tool success response (for tools that don't use message templates) * Uses Status + Key detail format */ export declare function formatToolSuccess(message: string, data?: any): MCPResponse; /** * Format a tool error response (for tools that don't use message templates) * Uses Status + Key detail format */ export declare function formatToolError(code: string, message: string, data?: any): MCPResponse; export {}; //# sourceMappingURL=messages.d.ts.map