delete_api_key
Delete an API key by UUID to immediately revoke access. This action cannot be undone and may break active sessions.
Instructions
Delete an API key by UUID. This cannot be undone, revokes access immediately, and can break active sessions using the key. Returns success after revocation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The UUID of the API key to delete |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the tool call succeeded and returned structured data | |
| data | No | Structured success payload when ok is true | |
| error | No | Structured error payload when ok is false |
Implementation Reference
- src/tools/keys.tools.ts:648-665 (handler)The async handler function for the 'delete_api_key' tool. It calls service.keys.deleteApiKey(params.id) and returns a JSON response with a success message and the result.
async (params) => { const result = await service.keys.deleteApiKey(params.id); return { content: [ { type: "text", text: JSON.stringify( { message: `Successfully deleted API key "${params.id}"`, success: result.success, }, null, 2, ), }, ], }; }, - src/services/keys.service.ts:215-218 (handler)The underlying service method that performs the actual HTTP DELETE request to /api-keys/{id}.
async deleteApiKey(id: string): Promise<{ success: boolean }> { await this.delete(`/api-keys/${this.encodePathSegment(id)}`); return { success: true }; } - src/tools/keys.tools.ts:208-210 (schema)Zod schema definition for the deleteApiKey tool input: requires a UUID string for the API key id.
deleteApiKey: { id: z.string().uuid().describe("The UUID of the API key to delete"), }, - src/tools/keys.tools.ts:643-667 (registration)Registration of the 'delete_api_key' tool on the MCP server via server.tool(), with description, schema, and handler.
// Phase 2: Delete API key tool server.tool( "delete_api_key", "Delete an API key by UUID. This cannot be undone, revokes access immediately, and can break active sessions using the key. Returns success after revocation.", KEYS_TOOL_SCHEMAS.deleteApiKey, async (params) => { const result = await service.keys.deleteApiKey(params.id); return { content: [ { type: "text", text: JSON.stringify( { message: `Successfully deleted API key "${params.id}"`, success: result.success, }, null, 2, ), }, ], }; }, ); }