export interface CorrelationConfig { enabled: boolean; maxRequestHistory: number; requestTTL: number; cleanupInterval: number; correlationIdLength: number; enablePerformanceTracking: boolean; enableMetricsCollection: boolean; } export interface CorrelationContext { correlationId: string; operationType: string; toolName?: string; conversationId?: string; timestamp: number; userId?: string; metadata?: Record; } /** * Comprehensive correlation ID tracking system * Enables end-to-end request tracing across MCP tools, handlers, and API calls */ export declare class CorrelationTracker { private static instance; private activeRequests; private requestHistory; private readonly maxHistorySize; private constructor(); static getInstance(): CorrelationTracker; /** * Generate a unique correlation ID */ generateCorrelationId(): string; /** * Start tracking a new request */ startRequest(operationType: string, toolName?: string, conversationId?: string, metadata?: Record): string; /** * Update request context with additional information */ updateRequest(correlationId: string, updates: Partial): void; /** * Complete request tracking and move to history */ completeRequest(correlationId: string, success?: boolean, errorMessage?: string): void; /** * Get active request context */ getRequestContext(correlationId: string): CorrelationContext | undefined; /** * Get request from history */ getRequestHistory(correlationId: string): CorrelationContext | undefined; /** * Get all active requests (for monitoring) */ getActiveRequests(): CorrelationContext[]; /** * Get recent request history (for debugging) */ getRecentHistory(limit?: number): CorrelationContext[]; /** * Get statistics about correlation tracking */ getStatistics(): { activeRequests: number; totalHistorySize: number; requestsByType: Record; averageDuration: number; successRate: number; }; /** * Get current configuration (add interface later for consistency) */ getConfiguration(): CorrelationConfig; /** * Update correlation tracker configuration */ updateConfiguration(newConfig: Partial): void; /** * Clean up old request history (for memory management) */ cleanup(olderThanMs?: number): void; /** * Clear all request history (for testing) */ clearHistory(): void; } /** * Correlation tracking middleware for MCP tools * Automatically wraps tool execution with correlation tracking */ export declare function withCorrelationTracking Promise>(toolName: string, operationType: string, handler: T): T; export declare const correlationTracker: CorrelationTracker; //# sourceMappingURL=correlationTracker.d.ts.map