UNPKG

firewalla-mcp-server

Version:

Model Context Protocol (MCP) server for Firewalla MSP API - Provides real-time network monitoring, security analysis, and firewall management through 28 specialized tools compatible with any MCP client

117 lines 3.63 kB
/** * Bulk Operation Management for Firewalla MCP Server * Provides infrastructure for performing operations on multiple resources efficiently */ import type { FirewallaClient } from '../firewalla/client.js'; /** * Result for a single item in a bulk operation */ export interface BulkOperationItemResult { /** The ID of the item that was processed */ id: string; /** Whether the operation succeeded for this item */ success: boolean; /** Error message if the operation failed */ error?: string; /** Error type if the operation failed */ errorType?: string; /** Additional result data if available */ data?: any; } /** * Overall result for a bulk operation */ export interface BulkOperationResult { /** Total number of items processed */ total: number; /** Number of successful operations */ successful: number; /** Number of failed operations */ failed: number; /** Results for each individual item */ results: BulkOperationItemResult[]; /** Summary statistics */ summary: { success_rate: number; processing_time_ms: number; errors_by_type: Record<string, number>; }; /** Any warnings or notes about the operation */ warnings?: string[]; } /** * Configuration for bulk operations */ export interface BulkOperationConfig { /** Maximum number of items that can be processed in a single bulk operation */ maxItems: number; /** Whether to continue processing if some items fail */ continueOnFailure: boolean; /** Timeout for the entire bulk operation (in milliseconds) */ timeoutMs: number; /** Number of items to process concurrently */ concurrency: number; /** Whether to collect detailed error information */ collectDetailedErrors: boolean; } /** * Function type for individual operations within a bulk operation */ export type BulkOperationFunction<T = any> = (id: string, firewalla: FirewallaClient, index: number) => Promise<T>; /** * Manager class for handling bulk operations */ export declare class BulkOperationManager { private config; constructor(config?: Partial<BulkOperationConfig>); /** * Validate bulk operation parameters */ validateBulkParams(ids: any): { isValid: boolean; errors: string[]; sanitizedIds: string[]; }; /** * Execute a bulk operation on multiple items */ executeBulkOperation<T = any>(ids: string[], operation: BulkOperationFunction<T>, firewalla: FirewallaClient, operationName: string): Promise<BulkOperationResult>; /** * Split array into chunks for controlled concurrency */ private chunkArray; /** * Create a configuration optimized for alarm operations */ static forAlarms(): BulkOperationManager; /** * Create a configuration optimized for rule operations */ static forRules(): BulkOperationManager; /** * Create a configuration optimized for device operations */ static forDevices(): BulkOperationManager; } /** * Utility function to create standardized bulk operation responses */ export declare function createBulkOperationResponse(result: BulkOperationResult, operationName: string): { content: { type: string; text: string; }[]; isError: boolean; }; /** * Validate common bulk operation parameters */ export declare function validateBulkOperationArgs(args: any): { isValid: boolean; errors: string[]; sanitizedArgs: { ids: string[]; options?: any; }; }; //# sourceMappingURL=bulk-operation-manager.d.ts.map