UNPKG

@felores/placid-mcp-server

Version:

Placid.app MCP server to list templates and generate images and videos

45 lines (44 loc) 1.03 kB
export class PlacidMcpError extends Error { code; constructor(message, code) { super(message); this.code = code; this.name = "PlacidMcpError"; } } export class ValidationError extends PlacidMcpError { constructor(message) { super(message); this.name = "ValidationError"; } } export class ApiError extends PlacidMcpError { constructor(message, code) { super(message, code); this.name = "ApiError"; } } export function formatError(error) { if (error instanceof PlacidMcpError) { return { type: "text", text: `${error.name}: ${error.message}`, }; } if (error instanceof Error) { return { type: "text", text: `Error: ${error.message}`, }; } return { type: "text", text: "An unknown error occurred", }; } export function createErrorResponse(error) { return { isError: true, content: [formatError(error)], }; }