api-key-rotate
Rotate platform API keys to maintain security by revoking old keys and generating new ones. Save the new key immediately after rotation.
Instructions
Rotate a platform API key — revokes the old key and returns a new one. Save the new key immediately.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hash | Yes | API key hash to rotate |
Implementation Reference
- src/tools/settings.ts:155-163 (handler)Handler function for the api-key-rotate tool.
async (params) => { try { const result = await client.settings.rotateApiKey(params.hash); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Error: ${message}` }], isError: true }; } }, - src/tools/settings.ts:149-164 (registration)Registration of the api-key-rotate tool.
server.tool( "api-key-rotate", "Rotate a platform API key — revokes the old key and returns a new one. Save the new key immediately.", { hash: z.string().describe("API key hash to rotate"), }, async (params) => { try { const result = await client.settings.rotateApiKey(params.hash); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Error: ${message}` }], isError: true }; } }, );