create_task
Creates a new task in your Storyblok space, specifying name, type, webhook URL, or lambda code. Manage content workflows by adding tasks directly via the API.
Instructions
Creates a new task in a specified Storyblok space using the Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the task | |
| task_type | No | Type of task | webhook |
| webhook_url | No | Webhook URL for the task | |
| description | No | Description of the task | |
| lambda_code | No | Lambda code for the task | |
| user_dialog | No | User dialog configuration |
Implementation Reference
- src/tools/tasks.ts:57-90 (handler)The handler function that executes the 'create_task' tool logic. It accepts task input fields (name, task_type, webhook_url, description, lambda_code, user_dialog), constructs a payload, and calls the Storyblok Management API POST /tasks/ endpoint.
// Tool: create_task server.tool( 'create_task', 'Creates a new task in a specified Storyblok space using the Management API.', { name: z.string().describe('Name of the task'), task_type: z.string().optional().default('webhook').describe('Type of task'), webhook_url: z.string().optional().describe('Webhook URL for the task'), description: z.string().optional().describe('Description of the task'), lambda_code: z.string().optional().describe('Lambda code for the task'), user_dialog: z.record(z.unknown()).optional().describe('User dialog configuration'), }, async ({ name, task_type, webhook_url, description, lambda_code, user_dialog }) => { try { const taskData: Record<string, unknown> = { name, task_type, webhook_url, description, lambda_code, user_dialog, }; const payload = { task: taskData }; const data = await apiPost('/tasks/', payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/tasks.ts:61-68 (schema)Zod schema definitions for 'create_task' input parameters: name (required string), task_type (optional string, default 'webhook'), webhook_url (optional string), description (optional string), lambda_code (optional string), user_dialog (optional record).
{ name: z.string().describe('Name of the task'), task_type: z.string().optional().default('webhook').describe('Type of task'), webhook_url: z.string().optional().describe('Webhook URL for the task'), description: z.string().optional().describe('Description of the task'), lambda_code: z.string().optional().describe('Lambda code for the task'), user_dialog: z.record(z.unknown()).optional().describe('User dialog configuration'), }, - src/tools/tasks.ts:58-59 (registration)Registration of 'create_task' tool via server.tool() on the MCP server, with the name 'create_task' and description 'Creates a new task in a specified Storyblok space using the Management API.'
server.tool( 'create_task', - src/tools/index.ts:79-79 (registration)The 'create_task' tool is registered as part of the tasks module via registerTasks(server) called in the main tool aggregator.
registerTasks(server); - src/types/storyblok.ts:293-301 (helper)The Task interface type definition used as the underlying data model for tasks, including id, name, description, task_type, webhook_url, lambda_code, and user_dialog fields.
export interface Task { id: number; name: string; description: string | null; task_type: string; webhook_url: string | null; lambda_code: string | null; user_dialog: Record<string, unknown> | null; }