retrieve_single_task
Retrieve a specific task from your Storyblok space by its ID. Use this to fetch task details for review or status updates.
Instructions
Retrieves a single task from a specified Storyblok space using the Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ID of the task to retrieve |
Implementation Reference
- src/tools/tasks.ts:44-54 (handler)Handler for retrieve_single_task: takes task_id, makes GET request to /tasks/{task_id}, returns JSON response or error.
async ({ task_id }) => { try { const data = await apiGet(`/tasks/${task_id}`); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } - src/tools/tasks.ts:37-55 (registration)Registration of retrieve_single_task via server.tool() with description, Zod schema for task_id, and handler.
// Tool: retrieve_single_task server.tool( 'retrieve_single_task', 'Retrieves a single task from a specified Storyblok space using the Management API.', { task_id: z.number().describe('ID of the task to retrieve'), }, async ({ task_id }) => { try { const data = await apiGet(`/tasks/${task_id}`); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/tasks.ts:41-43 (schema)Input schema: task_id (number) required.
{ task_id: z.number().describe('ID of the task to retrieve'), }, - src/utils/api.ts:180-190 (helper)apiGet helper: builds the management API URL, performs GET fetch with auth headers, handles 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)createJsonResponse helper: serializes data as pretty-printed JSON for MCP response.
export function createJsonResponse(data: unknown): McpSuccessResponse { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }