get-essential-subscriptions
Retrieve essential subscriptions for your Redis Cloud account using paginated results. Specify page and size parameters to access all subscriptions efficiently.
Instructions
Get the essential subscriptions for the current Cloud Redis account. A paginated response is returned, and to get all the essential subscriptions, the page and size parameters must be used until all the essential subscriptions are retrieved.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number | |
| size | No | Page size |
Implementation Reference
- Handler function for the get-essential-subscriptions tool. Extracts pagination parameters, validates input, fetches all essential subscriptions from the service, applies pagination, and returns a paginated Pageable response."get-essential-subscriptions": async (request) => { const { page = 0, size = DEFAULT_PAGE_SIZE } = extractArguments<{ page?: number; size?: number; }>(request); // Validate input validateToolInput( getSubscriptionsSchema, { page, size }, "Essential subscriptions request", ); const response = await executeApiCall( () => SubscriptionsEssentialsService.getAllSubscriptions1(), "Get essential subscriptions", ); const allSubscriptions = response.subscriptions || []; // Calculate pagination const startIndex = page * size; const endIndex = startIndex + size; const paginatedSubscriptions = allSubscriptions.slice(startIndex, endIndex); const pageable: Pageable = { page, size, }; return createToolResponse( createPage(paginatedSubscriptions, pageable, allSubscriptions.length), ); },
- Tool schema definition including name, description, and input schema for pagination parameters (page and size).const GET_ESSENTIAL_SUBSCRIPTIONS_TOOL: Tool = { name: "get-essential-subscriptions", description: "Get the essential subscriptions for the current Cloud Redis account. " + "A paginated response is returned, and to get all the essential subscriptions, the page and size parameters must be used until all the essential subscriptions are retrieved.", inputSchema: { type: "object", properties: { page: { type: "number", description: "Page number", default: 0, }, size: { type: "number", description: "Page size", default: DEFAULT_PAGE_SIZE, }, }, required: [], }, };
- src/index.ts:49-56 (registration)Registration of the tool handlers by spreading SUBSCRIPTIONS_ESSENTIALS_HANDLERS into the global ALL_HANDLERS object used by the MCP server for tool calls.const ALL_HANDLERS = { ...ACCOUNT_HANDLERS, ...SUBSCRIPTIONS_ESSENTIALS_HANDLERS, ...SUBSCRIPTIONS_PRO_HANDLERS, ...TASKS_HANDLERS, ...DATABASES_PRO_HANDLERS, ...DATABASES_ESSENTIALS_HANDLERS, };
- src/index.ts:40-47 (registration)Registration of the tool definitions by including SUBSCRIPTIONS_ESSENTIALS_TOOLS in the global ALL_TOOLS array returned by the list tools handler.const ALL_TOOLS = [ ...ACCOUNT_TOOLS, ...SUBSCRIPTIONS_PRO_TOOLS, ...SUBSCRIPTIONS_ESSENTIALS_TOOLS, ...TASKS_TOOLS, ...DATABASES_PRO_TOOLS, ...DATABASES_ESSENTIALS_TOOLS, ];
- Zod schema used for input validation in the handler (page and size parameters).const getSubscriptionsSchema = z.object({ page: commonSchemas.page, size: commonSchemas.size, });