@simonecoelhosfo/optimizely-mcp-server
Version:
Optimizely MCP Server for AI assistants with integrated CLI tools
73 lines • 2.27 kB
TypeScript
/**
* PaginationParameterExtractor - Intelligent extraction of pagination parameters
*
* Handles all possible ways AI agents might send pagination:
* - Nested vs flat structures
* - Different naming conventions (page/pageNumber/pageNum/offset)
* - Different size parameters (page_size/pageSize/limit/perPage/count)
* - Skip/take patterns
* - Offset/limit patterns
* - 0-based vs 1-based page numbers
*
* Created: January 8, 2025
*/
export interface ExtractedPagination {
page: number;
pageSize: number;
offset: number;
detectedFormat?: string;
warnings?: string[];
}
export declare class PaginationParameterExtractor {
private static readonly PAGE_FIELDS;
private static readonly SIZE_FIELDS;
private static readonly OFFSET_FIELDS;
/**
* Extract pagination parameters from various input formats
*/
static extract(input: any, defaults?: {
page?: number;
pageSize?: number;
}): ExtractedPagination;
/**
* Extract from nested pagination object: { options: { pagination: { page, page_size } } }
*/
private static extractFromNestedPagination;
/**
* Extract from flat options structure: { options: { page, page_size } }
*/
private static extractFromFlatStructure;
/**
* Extract from root level: { page, limit }
*/
private static extractFromRootLevel;
/**
* Extract from offset/limit pattern: { offset: 20, limit: 10 }
*/
private static extractFromOffsetLimit;
/**
* Extract from skip/take pattern: { skip: 20, take: 10 }
*/
private static extractFromSkipTake;
/**
* Extract from various "options" locations
*/
private static extractFromOptions;
/**
* Handle mixed formats where page and size are in different places
*/
private static extractFromMixedFormats;
/**
* Find a field value using multiple possible field names
*/
private static findFieldValue;
/**
* Validate and correct pagination values
*/
private static validateAndCorrect;
}
export declare function extractPagination(input: any, defaults?: {
page?: number;
pageSize?: number;
}): ExtractedPagination;
//# sourceMappingURL=PaginationParameterExtractor.d.ts.map