UNPKG

@dollhousemcp/mcp-server

Version:

DollhouseMCP - A Model Context Protocol (MCP) server that enables dynamic AI persona management from markdown files, allowing Claude and other compatible AI assistants to activate and switch between different behavioral personas.

76 lines 2.37 kB
/** * Utility functions for element ID parsing and formatting * * FIXES IMPLEMENTED (Issue #1099): * - Centralized element ID parsing logic * - Consistent separator usage (':') * - Validation and error handling * - Type-safe interfaces */ export declare const ELEMENT_ID_SEPARATOR = ":"; export interface ParsedElementId { type: string; name: string; } /** * Parse an element ID into its type and name components * * @param id Element ID in format "type:name" * @returns Parsed element ID or null if invalid */ export declare function parseElementId(id: string): ParsedElementId | null; /** * Parse an element ID, throwing an error if invalid * * @param id Element ID in format "type:name" * @returns Parsed element ID * @throws Error if ID is invalid */ export declare function parseElementIdStrict(id: string): ParsedElementId; /** * Parse an element ID with fallback values for invalid IDs * * @param id Element ID to parse * @param defaultType Default type if parsing fails * @param defaultName Default name if parsing fails (defaults to the original ID) * @returns Parsed element ID with fallbacks */ export declare function parseElementIdWithFallback(id: string, defaultType?: string, defaultName?: string): ParsedElementId; /** * Format an element ID from type and name components * * @param type Element type * @param name Element name * @returns Formatted element ID */ export declare function formatElementId(type: string, name: string): string; /** * Validate an element ID format * * @param id Element ID to validate * @returns true if valid, false otherwise */ export declare function isValidElementId(id: string): boolean; /** * Extract element IDs from an array of strings, filtering out invalid ones * * @param ids Array of potential element IDs * @returns Array of valid parsed element IDs */ export declare function parseElementIds(ids: string[]): ParsedElementId[]; /** * Batch parse element IDs with detailed error reporting * * @param ids Array of element IDs to parse * @returns Object with valid parsed IDs and errors for invalid ones */ export declare function batchParseElementIds(ids: string[]): { valid: Array<ParsedElementId & { originalId: string; }>; invalid: Array<{ id: string; reason: string; }>; }; //# sourceMappingURL=elementId.d.ts.map