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
64 lines • 2.88 kB
TypeScript
/**
* Advanced search utilities for Firewalla MCP Server
* Implements complex query parsing and search optimization
*/
import type { SearchFilter, SearchOptions } from '../types.js';
/**
* Parsed query component interface
*/
interface QueryComponent {
field?: string;
operator: 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'nin' | 'contains' | 'startswith' | 'endswith' | 'regex' | 'range';
value: string | number | boolean | Array<string | number | boolean>;
logical?: 'AND' | 'OR' | 'NOT';
}
/**
* Query parsing result interface
*/
interface ParsedQuery {
components: QueryComponent[];
filters: SearchFilter[];
optimized: string;
complexity: number;
}
/**
* Parses a raw search query string into structured query components and filters.
*
* Supports advanced syntax including logical operators (AND, OR, NOT), field comparisons, ranges, wildcards, arrays, and free-text search. Returns an object containing parsed components, filters for backend search, an optimized query string, and a complexity score.
*
* @param query - The raw search query string to parse
* @returns An object with parsed query components, filters, optimized query string, and complexity score
*/
export declare function parseSearchQuery(query: string): ParsedQuery;
/**
* Validates the syntax and complexity of a search query.
*
* Checks for empty queries, enforces a maximum complexity threshold, and validates regex patterns within the query. Returns an object indicating whether the query is valid and an array of error messages if any issues are found.
*
* @param query - The search query string to validate
* @param maxComplexity - The maximum allowed complexity score for the query (default is 10)
* @returns An object with a boolean `valid` flag and an array of `errors` describing any validation failures
*/
export declare function validateSearchQuery(query: string, maxComplexity?: number): {
valid: boolean;
errors: string[];
};
/**
* Constructs a `SearchOptions` object by combining filters from a parsed query with any additional options provided.
*
* @param parsedQuery - The parsed query containing filters to apply
* @param additionalOptions - Optional additional search options to merge
* @returns The combined search options object
*/
export declare function buildSearchOptions(parsedQuery: ParsedQuery, additionalOptions?: Partial<SearchOptions>): SearchOptions;
/**
* Returns an optimized version of the search query string for API use.
*
* Parses the input query and generates an optimized query string; if optimization is not possible, returns the original query.
*
* @param query - The raw search query string to format
* @returns The optimized query string suitable for API consumption
*/
export declare function formatQueryForAPI(query: string): string;
export {};
//# sourceMappingURL=index.d.ts.map