@spaik/mcp-server-roi
Version:
MCP server for AI ROI prediction and tracking with Monte Carlo simulations
86 lines • 3.05 kB
TypeScript
import { LogContext, createLogger } from './logger.js';
/**
* Generate a new correlation ID
*/
export declare function generateCorrelationId(): string;
/**
* Set correlation ID for a specific context
*/
export declare function setCorrelationId(contextKey: string, correlationId: string): void;
/**
* Get correlation ID for a specific context
*/
export declare function getCorrelationId(contextKey: string): string | undefined;
/**
* Clear correlation ID for a specific context
*/
export declare function clearCorrelationId(contextKey: string): void;
/**
* Create a logger with correlation ID
*/
export declare function createCorrelatedLogger(component: string, correlationId?: string, additionalContext?: LogContext): ReturnType<typeof createLogger> & {
correlationId: string;
child: (subComponent: string, childContext?: LogContext) => ReturnType<typeof createCorrelatedLogger>;
};
/**
* Async context manager for correlation IDs
*/
export declare class CorrelationContext {
private static asyncLocalStorage;
/**
* Run an async function with a correlation ID
*/
static run<T>(correlationId: string, fn: () => Promise<T>): Promise<T>;
/**
* Get current correlation ID from async context
*/
static getCurrentId(): string | undefined;
}
/**
* Express-style middleware for correlation IDs
*/
export declare function correlationMiddleware(req: any, res: any, next: () => void): void;
/**
* Tool execution logger with correlation
*/
export declare function createToolLogger(toolName: string, correlationId?: string): ReturnType<typeof createCorrelatedLogger>;
/**
* API call logger with correlation
*/
export declare function createApiLogger(apiName: string, endpoint: string, correlationId?: string): ReturnType<typeof createCorrelatedLogger>;
/**
* Database operation logger with correlation
*/
export declare function createDbLogger(operation: string, table?: string, correlationId?: string): ReturnType<typeof createCorrelatedLogger>;
/**
* Performance tracking with correlation
*/
export declare class PerformanceTracker {
private logger;
private startTime;
private checkpoints;
constructor(operationName: string, correlationId?: string, context?: LogContext);
checkpoint(name: string): void;
end(success?: boolean): void;
error(error: Error): void;
}
/**
* Structured error logging with correlation
*/
export declare function logStructuredError(error: Error, context: {
component: string;
operation: string;
correlationId?: string;
[key: string]: any;
}): void;
export declare const structuredLogger: {
createCorrelated: typeof createCorrelatedLogger;
createTool: typeof createToolLogger;
createApi: typeof createApiLogger;
createDb: typeof createDbLogger;
PerformanceTracker: typeof PerformanceTracker;
CorrelationContext: typeof CorrelationContext;
generateCorrelationId: typeof generateCorrelationId;
logStructuredError: typeof logStructuredError;
};
//# sourceMappingURL=structured-logger.d.ts.map