marketing-post-generator-mcp
Version:
A powerful MCP server for AI-powered marketing blog post generation with Claude integration
61 lines • 2.52 kB
TypeScript
import { ErrorHandler } from './ErrorHandler';
import { Logger } from '../../utils/logger';
export interface McpToolContext {
toolName: string;
arguments: Record<string, unknown>;
requestId?: string;
userId?: string;
}
export interface McpPromptContext {
promptName: string;
arguments: Record<string, unknown>;
requestId?: string;
userId?: string;
}
export interface McpErrorConfig {
criticalTools: string[];
criticalPrompts: string[];
errorTypeMappings: Record<string, string>;
severityOverrides: Record<string, 'low' | 'medium' | 'high' | 'critical'>;
}
export interface ErrorClassification {
isNetworkError: boolean;
isTimeoutError: boolean;
isAuthError: boolean;
isValidationError: boolean;
isConfigurationError: boolean;
originalError: Error;
}
export declare class McpErrorWrapper {
private readonly errorHandler;
private readonly logger;
private config;
constructor(errorHandler: ErrorHandler, logger: Logger, config?: Partial<McpErrorConfig>);
wrapToolExecution<T>(toolFunction: () => Promise<T>, context: McpToolContext): Promise<T>;
wrapPromptExecution<T>(promptFunction: () => Promise<T>, context: McpPromptContext): Promise<T>;
wrapWithRetry<T>(operation: () => Promise<T>, context: {
operationName: string;
requestId?: string;
}, retryOptions?: {
maxRetries?: number;
baseDelay?: number;
maxDelay?: number;
shouldRetry?: (error: Error) => boolean;
}): Promise<T>;
private determineSeverity;
private shouldNotifyForTool;
private shouldNotifyForPrompt;
private classifyError;
private createClassificationFromType;
updateConfig(config: Partial<McpErrorConfig>): void;
getConfig(): McpErrorConfig;
private delay;
/**
* Convert a standard error to an appropriate BaseError type based on classification
*/
private convertToTypedError;
}
export declare function createMcpErrorWrapper(errorHandler: ErrorHandler, logger: Logger, config?: Partial<McpErrorConfig>): McpErrorWrapper;
export declare function withToolErrorHandling(errorWrapper: McpErrorWrapper, toolName: string): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
export declare function withPromptErrorHandling(errorWrapper: McpErrorWrapper, promptName: string): (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
//# sourceMappingURL=McpErrorWrapper.d.ts.map