openapi-mcp-generator
Version:
Generates MCP server code from OpenAPI specifications
55 lines (54 loc) • 1.58 kB
TypeScript
/**
* General helper utilities for OpenAPI to MCP generator
*/
/**
* Safely stringify a JSON object with proper error handling
*
* @param obj Object to stringify
* @param defaultValue Default value to return if stringify fails
* @returns JSON string or default value
*/
export declare function safeJsonStringify(obj: any, defaultValue?: string): string;
/**
* Sanitizes a string for use in template strings
*
* @param str String to sanitize
* @returns Sanitized string safe for use in template literals
*/
export declare function sanitizeForTemplate(str: string): string;
/**
* Converts a string to camelCase
*
* @param str String to convert
* @returns camelCase string
*/
export declare function toCamelCase(str: string): string;
/**
* Converts a string to PascalCase
*
* @param str String to convert
* @returns PascalCase string
*/
export declare function toPascalCase(str: string): string;
/**
* Creates a valid variable name from a string
*
* @param str Input string
* @returns Valid JavaScript variable name
*/
export declare function toValidVariableName(str: string): string;
/**
* Checks if a string is a valid JavaScript identifier
*
* @param str String to check
* @returns True if valid identifier, false otherwise
*/
export declare function isValidIdentifier(str: string): boolean;
/**
* Formats a string for use in code comments
*
* @param str String to format
* @param maxLineLength Maximum line length
* @returns Formatted comment string
*/
export declare function formatComment(str: string, maxLineLength?: number): string;