retrieve_multiple_story_schedules
Retrieve multiple story schedules from a Storyblok space, with optional filtering by status (published_before_schedule or scheduled).
Instructions
Retrieves multiple story scheduling entries in a Storyblok space via the Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| space_id | Yes | Numeric ID of the Storyblok space | |
| by_status | No | Optional status filter ("published_before_schedule" or "scheduled") |
Implementation Reference
- src/tools/scheduling-stories.ts:22-37 (handler)The handler function for retrieve_multiple_story_schedules. It accepts an optional 'by_status' filter, builds query params, calls apiGet to the Storyblok Management API endpoint '/story_schedulings/', and returns the JSON response.
async ({ by_status }) => { try { const params: Record<string, string> = {}; if (by_status !== undefined) { params.by_status = by_status; } const data = await apiGet('/story_schedulings/', params); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } - Zod schema for input validation. Defines 'space_id' (required number) and 'by_status' (optional string with values like 'published_before_schedule' or 'scheduled').
{ space_id: z.number().describe('Numeric ID of the Storyblok space'), by_status: z .string() .optional() .describe('Optional status filter ("published_before_schedule" or "scheduled")'), }, - src/tools/scheduling-stories.ts:12-38 (registration)The tool is registered with the MCP server via server.tool() with the name 'retrieve_multiple_story_schedules', description, Zod schema, and handler function. The parent function registerSchedulingStories is called from src/tools/index.ts at line 78.
server.tool( 'retrieve_multiple_story_schedules', 'Retrieves multiple story scheduling entries in a Storyblok space via the Management API.', { space_id: z.number().describe('Numeric ID of the Storyblok space'), by_status: z .string() .optional() .describe('Optional status filter ("published_before_schedule" or "scheduled")'), }, async ({ by_status }) => { try { const params: Record<string, string> = {}; if (by_status !== undefined) { params.by_status = by_status; } const data = await apiGet('/story_schedulings/', params); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/utils/api.ts:180-190 (helper)Helper function apiGet used by the handler to make GET requests to the Storyblok Management API. It builds the full URL with query params, sets auth headers, and handles the response.
export async function apiGet<T = unknown>( path: string, params: Record<string, string> = {} ): Promise<T> { const url = buildUrlWithParams(buildManagementUrl(path), params); const response = await fetch(url, { method: 'GET', headers: getManagementHeaders(), }); return handleResponse<T>(response, url); } - src/utils/response.ts:26-30 (helper)Helper function createJsonResponse used by the handler to format the API response as a JSON string in the MCP text content format.
export function createJsonResponse(data: unknown): McpSuccessResponse { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }