/** * Standardized response formatting for element CRUD operations * * This module provides consistent response formatting across all element handlers, * addressing the type confusion between CrudResponse and MCP response formats. */ import { CrudResponse } from '../../types/CrudResponse.js'; import { ElementType } from '../../portfolio/PortfolioManager.js'; /** * MCP tool response format * This is the actual format returned by MCP tools */ export interface McpToolResponse { content: Array<{ type: 'text'; text: string; }>; isError?: boolean; } /** * Bridge between CrudResponse and MCP format * Converts structured CRUD responses to MCP tool responses */ export declare function crudResponseToMcp(response: CrudResponse, options?: { formatData?: (data: T) => string; context?: string; }): McpToolResponse; /** * Format a structured error response with consistent styling * * @param title - Bold title for the error (e.g., "Persona Not Found") * @param message - Main error message * @param suggestion - Optional suggestion for the user * @returns Formatted MCP response */ export declare function formatErrorResponse(title: string, message: string, suggestion?: string): McpToolResponse; /** * Format a simple success message */ export declare function formatSuccessResponse(message: string): McpToolResponse; /** * Format a simple error message */ export declare function formatSimpleErrorResponse(message: string): McpToolResponse; /** * Format element not found error with consistent styling */ export declare function formatNotFoundError(type: ElementType, name: string, listCommand?: string): McpToolResponse; /** * Issue #708: Format error for elements that exist on disk but failed validation. * Distinct from "not found" — the file is present but the server can't load it. */ export declare function formatValidationFailedError(type: ElementType, name: string, reason: string, filePath?: string): McpToolResponse; /** * Format duplicate element error with consistent styling */ export declare function formatDuplicateError(type: ElementType, name: string): McpToolResponse; /** * Format element creation success */ export declare function formatCreateSuccess(type: ElementType, name: string): McpToolResponse; /** * Format element update success */ export declare function formatUpdateSuccess(type: ElementType, name: string, field?: string): McpToolResponse; /** * Format element deletion success */ export declare function formatDeleteSuccess(type: ElementType, name: string): McpToolResponse; /** * Convert exception to formatted error response. * Issue #668: When the error is about invalid characters in a name, * suggest a corrected name so the caller can retry immediately. */ export declare function formatExceptionError(error: unknown, operation: string, type?: ElementType, name?: string): McpToolResponse; //# sourceMappingURL=responseFormatter.d.ts.map