/** * Tool Usage Analytics * Tracks which tools are called most, response times, cache hit rates. * Exposed via server://stats resource. */ export interface ToolCall { tool: string; timestamp: number; durationMs: number; success: boolean; cached: boolean; } export interface ToolStats { tool: string; callCount: number; avgDurationMs: number; maxDurationMs: number; errorCount: number; cacheHits: number; lastCalled?: string; } export interface AnalyticsReport { uptime: string; totalCalls: number; totalErrors: number; avgResponseMs: number; cacheHitRate: string; toolStats: ToolStats[]; recentCalls: { tool: string; durationMs: number; timestamp: string; }[]; } declare class Analytics { private calls; private startTime; /** Keep last 5000 calls */ private maxHistory; /** * Record a tool call. * @param tool - Tool name. * @param durationMs - Duration in milliseconds. * @param success - Whether the call succeeded. * @param cached - Whether the result was from cache. */ record(tool: string, durationMs: number, success: boolean, cached?: boolean): void; /** * Wrap an async tool handler with timing and recording. * @param tool - Tool name. * @param fn - The async function to wrap. * @param cached - Whether the result is from cache. * @returns The result of the wrapped function. */ track(tool: string, fn: () => Promise, cached?: boolean): Promise; /** * Get full analytics report. * @returns The analytics report with uptime, totals, and per-tool stats. */ getReport(): AnalyticsReport; /** * Get suggested actions based on analytics and codebase state. * @returns A list of suggested actions. */ getSuggestedActions(): string[]; } export declare const analytics: Analytics; export {}; //# sourceMappingURL=analytics.d.ts.map