UNPKG

jezweb-mcp-core

Version:

Jezweb Model Context Protocol (MCP) Core - A universal server for providing AI tools and resources, designed for seamless integration with various AI models and clients. Features adaptable multi-provider support, comprehensive tool and resource management

54 lines 1.75 kB
/** * Base Prompt Handler - Abstract class for MCP prompt handlers * * This class provides the foundation for handling MCP prompts protocol requests. * Unlike tool handlers, prompt handlers deal with prompts/list and prompts/get methods. */ import { MCPError } from '../../types/index.js'; import { ValidationResult } from '../../validation/index.js'; /** * Interface for prompt handler execution context */ export interface PromptHandlerContext { requestId: string | number | null; } /** * Abstract base class for prompt handlers */ export declare abstract class BasePromptHandler { protected context: PromptHandlerContext; constructor(context: PromptHandlerContext); /** * Template method that orchestrates validation and execution */ handle(params: any): Promise<any>; /** * Abstract method: Validate input parameters */ abstract validate(params: any): ValidationResult; /** * Abstract method: Execute the prompt operation */ abstract execute(params: any): Promise<any>; /** * Get the method name this handler is responsible for */ abstract getMethodName(): string; /** * Centralized error logging */ protected logError(error: any, params: any): void; /** * Sanitize parameters for logging (remove sensitive data) */ protected sanitizeParamsForLogging(params: any): any; /** * Helper method to create validation errors */ protected createValidationError(message: string, paramName?: string): MCPError; /** * Helper method to create execution errors */ protected createExecutionError(message: string, originalError?: any): MCPError; } //# sourceMappingURL=base-prompt-handler.d.ts.map