delete_secret
Remove sensitive data from a project by deleting stored secrets to maintain security and manage access controls.
Instructions
Delete a secret from a project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | The project ID | |
| key | Yes | Secret key to delete |
Implementation Reference
- src/tools/delete-secret.ts:11-38 (handler)The handleDeleteSecret function is the main handler that deletes a secret from a project. It validates the project exists via getProject(), makes an authenticated DELETE request to the API endpoint /admin/v1/projects/{project_id}/secrets/{key}, and returns a success message or error response.
export async function handleDeleteSecret(args: { project_id: string; key: string; }): Promise<{ content: Array<{ type: "text"; text: string }>; isError?: boolean }> { const project = getProject(args.project_id); if (!project) return projectNotFound(args.project_id); const res = await apiRequest( `/admin/v1/projects/${args.project_id}/secrets/${encodeURIComponent(args.key)}`, { method: "DELETE", headers: { Authorization: `Bearer ${project.service_key}`, }, }, ); if (!res.ok) return formatApiError(res, "deleting secret"); return { content: [ { type: "text", text: `Secret \`${args.key}\` deleted from project \`${args.project_id}\`.`, }, ], }; } - src/tools/delete-secret.ts:6-9 (schema)The deleteSecretSchema defines the input validation schema using Zod, requiring project_id (string) and key (string) parameters for identifying which secret to delete.
export const deleteSecretSchema = { project_id: z.string().describe("The project ID"), key: z.string().describe("Secret key to delete"), }; - src/index.ts:190-195 (registration)Registers the 'delete_secret' tool with the MCP server, providing the tool name, description ('Delete a secret from a project.'), schema, and handler function.
server.tool( "delete_secret", "Delete a secret from a project.", deleteSecretSchema, async (args) => handleDeleteSecret(args), );