@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.
62 lines • 2.85 kB
TypeScript
/**
* BaseActivationStrategy - Shared functionality for all activation strategies
*
* Provides common helper methods used by multiple strategy implementations:
* - Flexible element finding (by name or filename)
* - Error response formatting
*/
import { MCPResponse } from './ElementActivationStrategy.js';
/**
* Base class with shared utilities for activation strategies
*/
export declare abstract class BaseActivationStrategy {
/**
* Find an element by name, supporting both exact display name and filename (slug) matching
* @param name - The name or filename to search for
* @param elementList - List of elements to search through
* @returns The found element or undefined
*/
protected findElementFlexibly(name: string, elementList: any[]): Promise<any>;
/**
* Create a standard error response
* @param message - The error message
* @returns MCP-formatted error response
*/
protected createErrorResponse(message: string): MCPResponse;
/**
* Create a standard success response
* @param message - The success message
* @returns MCP-formatted success response
*/
protected createSuccessResponse(message: string): MCPResponse;
/**
* Throw an ElementNotFoundError for missing elements.
*
* This replaces the previous createNotFoundResponse which returned a success
* response with error text. Now we throw to ensure MCP-AQL returns success=false.
*
* @param name - The name of the element that wasn't found
* @param type - The type of element (for error message)
* @throws {ElementNotFoundError} Always throws
* @see Issue #275 - Handlers return success=true for missing elements
*/
protected throwNotFoundError(name: string, type: string): never;
/**
* @deprecated Use throwNotFoundError instead to ensure proper error handling.
* This method returns a success response which causes MCP-AQL to return success=true.
* @see Issue #275 - Handlers return success=true for missing elements
*/
protected createNotFoundResponse(name: string, type: string): MCPResponse;
/**
* Format a fail-safe warning for elements with CLI external restrictions.
* Appended to activation text so users are aware of restrictions even when
* permission_prompt is not available (non-Claude-Code clients).
*
* @param metadata - Element metadata (may contain gatekeeper.externalRestrictions)
* @returns Warning text or empty string if no restrictions
* @see Issue #642 — Fail-safe enforcement for externalRestrictions
*/
protected formatRestrictionWarning(metadata: Record<string, unknown>): string;
protected formatGatekeeperValidityWarning(metadata: Record<string, unknown>): string;
}
//# sourceMappingURL=BaseActivationStrategy.d.ts.map