delete_api_key
Remove an API key by providing its PocketBase record ID to revoke access.
Instructions
Delete an API key by its PocketBase record ID (from list_api_keys). Response: { deleted: true }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | PocketBase record ID of the API key to delete |
Implementation Reference
- src/index.ts:786-801 (registration)Registration of the 'delete_api_key' tool using server.tool(), defining its schema and handler function.
server.tool( "delete_api_key", "Delete an API key by its PocketBase record ID (from list_api_keys). Response: { deleted: true }.", { id: z.string().describe("PocketBase record ID of the API key to delete"), }, async ({ id }) => { const guard = requireApiKey(); if (guard) return guard; const result = await apiFetch(`/api/api-keys?id=${encodeURIComponent(id)}`, { method: "DELETE", headers: apiKeyHeaders(), }); return formatResult(result); } ); - src/index.ts:789-791 (schema)Input schema for delete_api_key: accepts a single 'id' string parameter (PocketBase record ID).
{ id: z.string().describe("PocketBase record ID of the API key to delete"), }, - src/index.ts:792-800 (handler)Handler function for delete_api_key. Checks auth, then sends a DELETE request to /api/api-keys?id=<id> with API key headers, and returns the formatted result.
async ({ id }) => { const guard = requireApiKey(); if (guard) return guard; const result = await apiFetch(`/api/api-keys?id=${encodeURIComponent(id)}`, { method: "DELETE", headers: apiKeyHeaders(), }); return formatResult(result); } - src/index.ts:34-38 (helper)The apiKeyHeaders() helper function used by the handler to add X-API-Key auth headers.
function apiKeyHeaders(extra?: Record<string, string>): Record<string, string> { const h: Record<string, string> = { "Content-Type": "application/json" }; if (API_KEY) h["X-API-Key"] = API_KEY; return { ...h, ...extra }; } - src/index.ts:73-82 (helper)The formatResult() helper used to format the API response into MCP text content.
function formatResult(result: ApiResult): { content: Array<{ type: "text"; text: string }> } { return { content: [ { type: "text" as const, text: JSON.stringify(result.data, null, 2), }, ], }; }