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.

115 lines 4.61 kB
/** * Configuration handler for the dollhouse_config MCP tool * Provides unified interface for all configuration management operations */ import { ConfigManager } from '../config/ConfigManager.js'; import { InitializationService } from '../services/InitializationService.js'; import { PersonaIndicatorService } from '../services/PersonaIndicatorService.js'; import { AgentSkillConverter, type SkillConversionOptions } from '../converters/AgentSkillConverter.js'; export interface ConfigOperationOptions { action: 'get' | 'set' | 'reset' | 'export' | 'import' | 'wizard'; setting?: string; value?: any; section?: string; format?: 'yaml' | 'json'; data?: string; } export type SkillFormatConversionOptions = SkillConversionOptions; export declare class ConfigHandler { private readonly configManager; private readonly initService; private readonly indicatorService; private readonly agentSkillConverter; constructor(configManager: ConfigManager, initService: InitializationService, indicatorService: PersonaIndicatorService, agentSkillConverter?: AgentSkillConverter); /** * Convert between current Agent Skill and Dollhouse Skill formats. * * This operation is pure/in-memory: it does not read or write files. * Use `roundtrip_state` for lossless reverse conversion of supported fields. */ convertSkillFormat(options: SkillFormatConversionOptions): Promise<import("../converters/AgentSkillConverter.js").SkillConversionResult>; /** * Handle configuration operations via the dollhouse_config tool * * @param options - Configuration operation options * @param options.action - The action to perform (get, set, reset, export, import, wizard) * @param options.setting - Optional setting path for get/set operations * @param options.value - Optional value for set operations * @param options.section - Optional section for filtering * @param options.format - Optional format for export (yaml or json) * @param options.data - Optional data for import operations * @returns Promise resolving to content object with operation result * @async * * @note The wizard action is async and will await the handleWizard method * @since v1.4.0 - handleWizard made async for better config fetching */ handleConfigOperation(options: ConfigOperationOptions): Promise<{ content: { type: string; text: string; }[]; }>; private handleGet; private handleSet; private handleReset; private handleExport; private handleImport; /** * Handle the configuration wizard * @returns Promise with wizard interface content * @async */ private handleWizard; /** * Format a value for user-friendly display * Replaces null/undefined with helpful messages */ private formatValue; /** * Make configuration display user-friendly for non-technical users * Replaces null values with helpful explanations * Uses centralized friendly values for i18n support */ private makeFriendlyConfig; /** * Apply legacy manual replacements for backward compatibility * Extracted to reduce cognitive complexity */ private applyLegacyReplacements; /** * Get friendly status message for wizard configuration * Extracted to reduce cognitive complexity */ private getWizardStatusMessage; /** * Format source priority configuration for display */ private formatSourcePriorityConfig; /** * Handle setting source priority configuration */ private handleSourcePrioritySet; /** * Handle setting indicator configuration with validation and immediate runtime update. * * This method provides unified immediate+persistent behavior: * 1. Validates the value against allowed options * 2. Saves to persistent config file * 3. Updates runtime PersonaIndicatorService for immediate effect * * @param options - Configuration options with setting path and value * @param indicator - Current indicator prefix for output formatting * @returns Promise with operation result */ private handleIndicatorSet; /** * Validate an indicator configuration value based on its property type. * * @param prop - The IndicatorConfig property name * @param value - The value to validate * @returns Error message if invalid, undefined if valid */ private validateIndicatorValue; } //# sourceMappingURL=ConfigHandler.d.ts.map