resolve_discussion
Resolve a discussion in Storyblok by providing its numeric ID and the timestamp when it was solved.
Instructions
Marks a discussion as resolved via the Storyblok Management API.
discussion_id: Numeric ID of the discussion.
solved_at: Timestamp when the discussion is resolved (ISO 8601 format).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| discussion_id | Yes | Numeric ID of the discussion | |
| solved_at | Yes | Timestamp when the discussion is resolved (ISO 8601 format) |
Implementation Reference
- src/tools/discussions.ts:180-207 (handler)The handler function for the 'resolve_discussion' tool. It receives discussion_id and solved_at, constructs a payload with solved_at, sends a PUT request to /discussions/{discussion_id}, and returns the JSON response.
// Tool: resolve_discussion server.tool( 'resolve_discussion', `Marks a discussion as resolved via the Storyblok Management API. - discussion_id: Numeric ID of the discussion. - solved_at: Timestamp when the discussion is resolved (ISO 8601 format).`, { discussion_id: z.number().describe('Numeric ID of the discussion'), solved_at: z.string().describe('Timestamp when the discussion is resolved (ISO 8601 format)'), }, async ({ discussion_id, solved_at }) => { try { const payload = { discussion: { solved_at, }, }; const data = await apiPut(`/discussions/${discussion_id}`, payload); return createJsonResponse(data); } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/discussions.ts:183-190 (schema)Input schema for the 'resolve_discussion' tool defining two parameters: discussion_id (z.number()) and solved_at (z.string(), ISO 8601 format).
`Marks a discussion as resolved via the Storyblok Management API. - discussion_id: Numeric ID of the discussion. - solved_at: Timestamp when the discussion is resolved (ISO 8601 format).`, { discussion_id: z.number().describe('Numeric ID of the discussion'), solved_at: z.string().describe('Timestamp when the discussion is resolved (ISO 8601 format)'), }, - src/tools/discussions.ts:18-18 (registration)The tool is registered inside the registerDiscussions function via server.tool('resolve_discussion', ...) at line 181-182.
export function registerDiscussions(server: McpServer): void { - src/utils/api.ts:211-222 (helper)The apiPut helper function used by the handler to send a PUT request to the Storyblok Management API with a JSON body.
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/utils/response.ts:26-30 (helper)The createJsonResponse helper used to format the successful response as JSON.
export function createJsonResponse(data: unknown): McpSuccessResponse { return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }], }; }