Error formatter for MCP responses
Formats errors for safe transmission to MCP clients. Internal errors are sanitized to prevent information leakage while preserving useful debugging information for expected error types.
Error to format
Formatted error object safe for client transmission
try { const result = await processMEPRequest(args); return { content: [{ type: 'text', text: JSON.stringify(result) }] };} catch (error) { const formatted = formatMCPError(error); return { content: [{ type: 'text', text: JSON.stringify(formatted) }] };} Copy
try { const result = await processMEPRequest(args); return { content: [{ type: 'text', text: JSON.stringify(result) }] };} catch (error) { const formatted = formatMCPError(error); return { content: [{ type: 'text', text: JSON.stringify(formatted) }] };}
Error formatter for MCP responses
Formats errors for safe transmission to MCP clients. Internal errors are sanitized to prevent information leakage while preserving useful debugging information for expected error types.