create_branch_deployment
Deploy selected releases to a specific branch pipeline stage by providing the branch ID and release UUIDs.
Instructions
Triggers a deployment of specified releases to a given branch (pipeline stage).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| branch_id | Yes | Numeric ID of the branch to deploy to | |
| release_uuids | Yes | List of release UUIDs to deploy |
Implementation Reference
- src/tools/branch-deployments.ts:10-35 (handler)The handler function that executes the 'create_branch_deployment' tool logic. It validates inputs (branch_id and release_uuids), POSTs to /deployments/ endpoint, and returns the JSON response.
export function registerBranchDeployments(server: McpServer): void { // Tool: create_branch_deployment server.tool( 'create_branch_deployment', 'Triggers a deployment of specified releases to a given branch (pipeline stage).', { branch_id: z.number().describe('Numeric ID of the branch to deploy to'), release_uuids: z.array(z.string()).describe('List of release UUIDs to deploy'), }, async ({ branch_id, release_uuids }) => { try { const payload = { branch_id, release_uuids, }; const data = await apiPost('/deployments/', payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); } - Zod schema defining the input parameters: branch_id (number) and release_uuids (array of strings).
{ branch_id: z.number().describe('Numeric ID of the branch to deploy to'), release_uuids: z.array(z.string()).describe('List of release UUIDs to deploy'), }, - src/tools/index.ts:65-65 (registration)Registration call that wires the create_branch_deployment tool into the MCP server.
registerBranchDeployments(server); - src/tools/index.ts:15-15 (registration)Import statement for the branch-deployments module.
import { registerBranchDeployments } from './branch-deployments.js'; - src/utils/api.ts:195-206 (helper)The apiPost helper function used by the handler to make POST requests 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); }