delete_access_token
Removes a specific access token from your Storyblok space to manage API access.
Instructions
Delete an access token from the current Storyblok space using the Management API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_id | Yes | The ID of the access token to delete |
Implementation Reference
- src/tools/access-tokens.ts:139-176 (handler)The 'delete_access_token' tool handler: registers an MCP tool that accepts a token_id parameter, builds a DELETE request URL to /api_keys/{token_id}, calls the Storyblok Management API, and returns success (204) or failure responses.
// Tool: delete_access_token server.tool( 'delete_access_token', 'Delete an access token from the current Storyblok space using the Management API.', { token_id: z.number().describe('The ID of the access token to delete'), }, async ({ token_id }) => { try { const url = buildManagementUrl(`/api_keys/${token_id}`); const response = await fetch(url, { method: 'DELETE', headers: getManagementHeaders(), }); if (response.status === 204) { return { content: [{ type: 'text' as const, text: 'Access Token deleted successfully.' }], }; } else { return { isError: true, content: [ { type: 'text' as const, text: `Failed to delete Access token. Status code: ${response.status}`, }, ], }; } } catch (error) { if (error instanceof APIError) { return createErrorResponse(error); } throw error; } } ); - src/tools/access-tokens.ts:143-144 (schema)The Zod schema for the 'delete_access_token' tool: the only input parameter is token_id, a required number.
{ token_id: z.number().describe('The ID of the access token to delete'), - src/tools/index.ts:52-52 (registration)Registration of all access token tools (including delete_access_token) via registerAccessTokens(server) in the tool aggregator.
registerAccessTokens(server); - src/tools/access-tokens.ts:16-16 (registration)The export function registerAccessTokens that registers all access token tools on the MCP server.
export function registerAccessTokens(server: McpServer): void { - src/utils/api.ts:118-120 (helper)The buildManagementUrl helper used to construct the DELETE request URL for the delete_access_token handler.
export function buildManagementUrl(path: string): string { return `${API_ENDPOINTS.MANAGEMENT}/spaces/${cfg.spaceId}${path}`; }