@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
96 lines • 3.2 kB
TypeScript
/**
* Pagination Configuration Manager
* @description Centralized configuration for pagination behavior across the MCP server.
* Manages page sizes, bypass limits, and entity-specific defaults to ensure
* consistent pagination behavior and prevent overwhelming AI agents with large datasets.
*
* Key features:
* - Environment-based configuration with sensible defaults
* - Entity-specific pagination rules based on typical dataset sizes
* - Smart bypass detection for small entities (attributes, environments)
* - Hard limits to prevent memory issues with large datasets
*
* @author Optimizely MCP Server
* @version 1.0.0
*/
/**
* Pagination configuration interface
*/
export interface PaginationConfig {
defaultPageSize: number;
complexPageSize: number;
simplePageSize: number;
bypassMax: number;
autoBypassEntities: string[];
warnThreshold: number;
}
/**
* Entity-specific pagination defaults
*/
export interface EntityPaginationDefaults {
[entityType: string]: {
autoBypass: boolean;
typicalSize: string;
warnThreshold?: number;
};
}
/**
* Manages pagination configuration for the MCP server
*/
export declare class PaginationConfigManager {
private config;
private entityDefaults;
constructor();
/**
* Get the appropriate page size for an entity type
* @param entityType The type of entity being queried
* @param isSimplified Whether simplified/condensed data is requested
* @returns The page size to use
*/
getPageSize(entityType: string, isSimplified?: boolean): number;
/**
* Check if pagination should be automatically bypassed for an entity type
* @param entityType The type of entity being queried
* @returns Whether to bypass pagination
*/
shouldAutoBypass(entityType: string): boolean;
/**
* Get the maximum number of records allowed when bypassing pagination
* @returns The bypass limit
*/
getBypassLimit(): number;
/**
* Get the warning threshold for an entity type
* @param entityType The type of entity
* @returns The number of records that triggers a warning
*/
getWarnThreshold(entityType: string): number;
/**
* Check if a bypass request is valid
* @param totalCount The total number of records
* @param requestedBypass Whether bypass was explicitly requested
* @returns Object indicating if bypass is allowed and any warnings
*/
validateBypassRequest(totalCount: number, requestedBypass: boolean): {
allowed: boolean;
reason?: string;
suggestion?: string;
};
/**
* Get entity metadata for documentation
* @param entityType The type of entity
* @returns Metadata about the entity's pagination behavior
*/
getEntityMetadata(entityType: string): {
autoBypass: boolean;
typicalSize: string;
recommendation: string;
};
/**
* Get all configuration values for debugging
* @returns Current configuration
*/
getConfig(): PaginationConfig;
}
export declare const paginationConfig: PaginationConfigManager;
//# sourceMappingURL=PaginationConfig.d.ts.map