Skip to main content
Glama

delete_api_key

Destructive

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

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe UUID of the API key to delete

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYesWhether the tool call succeeded and returned structured data
dataNoStructured success payload when ok is true
errorNoStructured error payload when ok is false

Implementation Reference

  • 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,
    				),
    			},
    		],
    	};
    },
  • 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 };
    }
  • 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"),
    },
  • 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,
    						),
    					},
    				],
    			};
    		},
    	);
    }
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds beyond annotations: 'This cannot be undone, revokes access immediately, and can break active sessions using the key.' This provides critical behavioral context beyond the destructiveHint annotation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no wasted words. The action and key behavioral implications are front-loaded, making it easy for an agent to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple nature of the tool with one parameter and an output schema, the description covers the essential behavioral aspects. Could mention the return value but not strictly necessary.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides a complete description of the 'id' parameter (UUID format and constraints). The description does not add further semantics, so baseline score applies due to high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Delete an API key by UUID', specifying the resource (API key) and action (delete). It is distinct from sibling tools like create_api_key, update_api_key, or get_api_key.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description mentions the irreversible and immediate effects, implying cautious use. However, it does not explicitly state when to use this tool versus alternatives (e.g., disabling the key).

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/s-b-e-n-s-o-n/portkey-admin-mcp'

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