UNPKG

@makingchatbots/genesys-cloud-mcp-server

Version:

A Model Context Protocol (MCP) server exposing Genesys Cloud tools for LLMs, including sentiment analysis, conversation search, topic detection and more.

25 lines (24 loc) 919 B
export function paginationSection(totalSectionName, { pageSize, pageNumber, totalHits, pageCount }) { const calculateTotalPages = (totalHits, pageSize) => { if (totalHits === 0 && pageSize === 0) { return 1; } else { return Math.max(1, Math.ceil((totalHits ?? 0) / pageSize)); } }; let formattedTotalPages = "N/A"; if (pageCount !== undefined) { formattedTotalPages = String(pageCount); } else if (pageSize !== undefined && pageSize > 0) { formattedTotalPages = String(calculateTotalPages(totalHits, pageSize)); } return [ "--- Pagination Info ---", `Page Number: ${pageNumber ? String(pageNumber) : "N/A"}`, `Page Size: ${pageSize ? String(pageSize) : "N/A"}`, `Total Pages: ${formattedTotalPages}`, `${totalSectionName}: ${totalHits ? String(totalHits) : "N/A"}`, ]; }