create_story_schedule
Schedule a story for publication by setting its publish date and optional language using the Storyblok Management API.
Instructions
Creates a new story schedule via the Storyblok Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| story_id | Yes | Numeric ID of the story to be scheduled | |
| publish_at | Yes | ISO-8601 date/time string in UTC (e.g., "2025-06-20T15:30:00Z") | |
| language | No | Optional language code (e.g., "en", "pt-br") |
Implementation Reference
- src/tools/scheduling-stories.ts:60-91 (handler)The handler function for the 'create_story_schedule' tool. It accepts story_id, publish_at, and optional language, builds a payload object, and POSTs it to '/story_schedulings' via apiPost, returning the JSON response.
// Tool: create_story_schedule server.tool( 'create_story_schedule', 'Creates a new story schedule via the Storyblok Management API.', { story_id: z.number().describe('Numeric ID of the story to be scheduled'), publish_at: z .string() .describe('ISO-8601 date/time string in UTC (e.g., "2025-06-20T15:30:00Z")'), language: z.string().optional().describe('Optional language code (e.g., "en", "pt-br")'), }, async ({ story_id, publish_at, language }) => { try { const storySchedulingData: Record<string, unknown> = { story_id, publish_at, }; if (language !== undefined) { storySchedulingData.language = language; } const payload = { story_scheduling: storySchedulingData }; const data = await apiPost('/story_schedulings', payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - Input schema for 'create_story_schedule': story_id (number), publish_at (string, ISO-8601), and optional language (string).
{ story_id: z.number().describe('Numeric ID of the story to be scheduled'), publish_at: z .string() .describe('ISO-8601 date/time string in UTC (e.g., "2025-06-20T15:30:00Z")'), language: z.string().optional().describe('Optional language code (e.g., "en", "pt-br")'), }, - src/tools/index.ts:77-78 (registration)Registration call: registerSchedulingStories(server) is invoked in registerAllTools, which registers all scheduling story tools including 'create_story_schedule'.
registerReleases(server); registerSchedulingStories(server); - src/tools/index.ts:22-29 (registration)Import statement for registerSchedulingStories from scheduling-stories.ts.
import { registerSchedulingStories } from './scheduling-stories.js'; import { registerSpace } from './space.js'; import { registerSpaceRoles } from './space-roles.js'; import { registerTasks } from './tasks.js'; import { registerWebhooks } from './webhooks.js'; import { registerWorkflows } from './workflows.js'; import { registerWorkflowStages } from './workflow-stage.js'; import { registerWorkflowStageChanges } from './workflow-stage-changes.js'; - src/utils/api.ts:195-206 (helper)The apiPost helper function used by the create_story_schedule handler to make the POST request to the Storyblok Management API.
export async function apiPost<T = unknown>( path: string, body: unknown ): Promise<T> { const url = buildManagementUrl(path); const response = await fetch(url, { method: 'POST', headers: getManagementHeaders(), body: JSON.stringify(body), }); return handleResponse<T>(response, url); }