mcp-adr-analysis-server
Version:
MCP server for analyzing Architectural Decision Records and project architecture
38 lines • 1.49 kB
TypeScript
/**
* JSON-Safe String Utilities
*
* Utilities for safely escaping strings in JSON-RPC 2.0 responses
* to prevent parse errors in MCP communication
*/
/**
* Escape a string to be JSON-safe for MCP responses
* Only escapes actual control characters and problematic JSON chars
*/
export declare function jsonSafe(str: string | undefined | null): string;
/**
* Escape an array of strings to be JSON-safe
*/
export declare function jsonSafeArray(arr: (string | undefined | null)[]): string[];
/**
* Safely join an array of strings with JSON-safe escaping
*/
export declare function jsonSafeJoin(arr: (string | undefined | null)[], separator?: string): string;
/**
* Create a JSON-safe markdown list from an array of items
*/
export declare function jsonSafeMarkdownList(items: (string | undefined | null)[], prefix?: string): string;
/**
* Safely escape file paths for JSON output - minimal escaping for display
* Only normalizes path separators and escapes quotes
*/
export declare function jsonSafeFilePath(filePath: string | undefined | null): string;
/**
* Safely escape user input content that might contain dangerous characters
* Use this for content that comes from external sources or user input
*/
export declare function jsonSafeUserInput(str: string | undefined | null): string;
/**
* Safely escape error messages that might contain quotes or special chars
*/
export declare function jsonSafeError(error: unknown): string;
//# sourceMappingURL=json-safe.d.ts.map