Skip to main content
Glama

revoke_api_key

Revoke an API key permanently to disable access. This action cannot be undone, providing immediate security control for the Stacksfinder MCP server.

Instructions

Revokes an API key. This action cannot be undone.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyIdYesThe UUID of the API key to revoke

Implementation Reference

  • Executes the revoke_api_key tool by sending a DELETE request to the StacksFinder API to revoke the specified API key ID. Handles authentication, errors, and success responses.
    export async function executeRevokeApiKey( input: RevokeApiKeyInput ): Promise<{ text: string; isError?: boolean }> { const config = getConfig(); const { keyId } = input; if (!config.apiKey) { return { text: `**Error**: No API key configured. Set STACKSFINDER_API_KEY environment variable.`, isError: true }; } debug('Revoking API key', keyId); try { const response = await fetch(`${config.apiUrl}/api/v1/keys/${keyId}`, { method: 'DELETE', headers: { Authorization: `Bearer ${config.apiKey}`, 'Content-Type': 'application/json' } }); if (!response.ok) { if (response.status === 401) { return { text: '**Error**: Invalid API key. Please reconfigure with a valid key.', isError: true }; } if (response.status === 404) { return { text: `**Error**: API key not found or already revoked.`, isError: true }; } const errorText = await response.text(); return { text: `**Error**: Failed to revoke key (${response.status}): ${errorText}`, isError: true }; } return { text: `## API Key Revoked The API key \`${keyId}\` has been revoked and can no longer be used. **Note**: If you revoked the key you're currently using, you'll need to configure a new one.` }; } catch (err) { const errorMessage = err instanceof Error ? err.message : 'Failed to revoke API key'; return { text: `**Error**: ${errorMessage}`, isError: true }; } }
  • Zod input schema validating the keyId parameter for the revoke_api_key tool.
    * Input schema for revoke_api_key tool. */ export const RevokeApiKeyInputSchema = z.object({ keyId: z.string().uuid().describe('The UUID of the API key to revoke') });
  • src/server.ts:353-377 (registration)
    Registers the revoke_api_key tool on the MCP server, including input schema, annotations, and the handler wrapper that parses input and calls executeRevokeApiKey.
    // Register revoke_api_key tool (API-based, requires API key) server.registerTool( revokeApiKeyToolDefinition.name, { title: 'Revoke API Key', description: revokeApiKeyToolDefinition.description, inputSchema: { keyId: z.string().uuid().describe('The UUID of the API key to revoke') }, annotations: { readOnlyHint: false, destructiveHint: true, openWorldHint: false } }, async (args) => { debug('revoke_api_key called', args.keyId); const input = RevokeApiKeyInputSchema.parse(args); const { text, isError } = await executeRevokeApiKey(input); return { content: [{ type: 'text', text }], isError }; } );
  • Tool metadata definition including name and description for revoke_api_key, used during registration.
    /** * Tool definition for revoke_api_key. */ export const revokeApiKeyToolDefinition = { name: 'revoke_api_key', description: 'Revokes an API key. This action cannot be undone.' };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hoklims/stacksfinder-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server