import { Tool } from '@modelcontextprotocol/sdk/types.js';
import { ResourceManager } from '../utils/resource-manager.js';
import { SessionResourceManager } from '../utils/session-resource-manager.js';
/**
 * Base interface for all tool handlers
 */
export interface ToolHandler {
    /**
     * Array of tools this handler provides
     */
    tools: Tool[];
    /**
     * Handle a tool request
     * @param toolName The name of the tool to execute
     * @param args The arguments passed to the tool
     * @param sessions Active debugging sessions
     * @returns Promise with the tool result
     */
    handle(toolName: string, args: any, sessions: Map<string, any>): Promise<any>;
    /**
     * Optional initialization method
     */
    initialize?(): Promise<void>;
}
export interface BaseHandlerOptions {
    resourceManager?: ResourceManager;
    sessionResourceManager?: SessionResourceManager;
}
/**
 * Base class with common functionality for tool handlers
 */
export declare abstract class BaseToolHandler implements ToolHandler {
    abstract tools: Tool[];
    abstract handle(toolName: string, args: any, sessions: Map<string, any>): Promise<any>;
    /**
     * Helper to get a session or throw if not found
     */
    protected getSession(sessionId: string, sessions: Map<string, any>): any;
    /**
     * Format content for tool response
     */
    protected formatResponse(content: string, mimeType?: string): any;
    /**
     * Helper to validate required args
     */
    protected validateArgs(args: any, requiredFields: string[]): void;
}
/**
 * Base handler with resource management capabilities
 */
export declare abstract class BaseHandler extends BaseToolHandler {
    protected readonly resourceManager: ResourceManager;
    protected readonly sessionResourceManager: SessionResourceManager;
    protected readonly handlerName: string;
    tools: Tool[];
    handle(toolName: string, args: any, sessions: Map<string, any>): Promise<any>;
    constructor(options?: BaseHandlerOptions);
    /**
     * Track a resource for automatic cleanup
     */
    protected trackResource(resourceType: 'page' | 'browser' | 'context', sessionId: string, resource: any): void;
    /**
     * Get session with resource tracking - replaces the problematic sessions.get() pattern
     */
    protected getSessionWithTracking(sessionId: string, sessions: Map<string, any>): any;
    /**
     * Cleanup resources for this handler
     */
    protected cleanup(sessionId?: string): Promise<void>;
    /**
     * Get resource cleanup timeout based on resource type
     */
    protected getCleanupTimeout(resourceType: 'page' | 'browser' | 'context'): number;
}
//# sourceMappingURL=base-handler-migrated.d.ts.map