update_workflow
Update an existing workflow's name and content types in your Storyblok space.
Instructions
Updates an existing workflow in a Storyblok space via the Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workflow_id | Yes | ID of the workflow to update | |
| name | Yes | New name for the workflow | |
| content_types | Yes | New list of content types |
Implementation Reference
- src/tools/workflows.ts:91-108 (handler)The async handler function that executes the 'update_workflow' tool logic. It accepts workflow_id, name, and content_types, constructs a payload, and calls apiPut to the Storyblok Management API.
async ({ workflow_id, name, content_types }) => { try { const payload = { workflow: { name, content_types, }, }; const data = await apiPut(`/workflows/${workflow_id}`, payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } - src/tools/workflows.ts:86-90 (schema)Zod schemas defining the input parameters for the 'update_workflow' tool: workflow_id (number), name (string), and content_types (array of strings).
{ workflow_id: z.number().describe('ID of the workflow to update'), name: z.string().describe('New name for the workflow'), content_types: z.array(z.string()).describe('New list of content types'), }, - src/tools/workflows.ts:82-109 (registration)The MCP tool registration call using server.tool() with the name 'update_workflow' and a description.
// Tool: update_workflow server.tool( 'update_workflow', 'Updates an existing workflow in a Storyblok space via the Management API.', { workflow_id: z.number().describe('ID of the workflow to update'), name: z.string().describe('New name for the workflow'), content_types: z.array(z.string()).describe('New list of content types'), }, async ({ workflow_id, name, content_types }) => { try { const payload = { workflow: { name, content_types, }, }; const data = await apiPut(`/workflows/${workflow_id}`, payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/utils/api.ts:211-222 (helper)The apiPut helper function used by the handler to make a PUT request to the Storyblok Management API.
export async function apiPut<T = unknown>( path: string, body: unknown ): Promise<T> { const url = buildManagementUrl(path); const response = await fetch(url, { method: 'PUT', headers: getManagementHeaders(), body: JSON.stringify(body), }); return handleResponse<T>(response, url); } - src/tools/index.ts:59-61 (registration)The registerWorkflows function is called from the central tool aggregator to register all workflow tools including 'update_workflow'.
registerWorkflows(server); registerWorkflowStages(server); registerWorkflowStageChanges(server);