deleteDeployment
Remove a specific deployment by its ID using Vercel MCP. This tool enables efficient cleanup of deployments while requiring the deployment identifier as input.
Instructions
Deletes a deployment
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| deploymentId | Yes | The ID of the deployment to delete | |
| slug | No | Slug | |
| teamId | No | Team ID | |
| url | No | The URL of the deployment |
Implementation Reference
- src/index.ts:322-347 (handler)The handler function for the MCP 'deleteDeployment' tool. It creates the environment with API token, calls the underlying deleteDeployment helper, formats the result as JSON text response, and handles errors.async ({ deploymentId, ...options }) => { try { const env = { VERCEL_API_TOKEN: apiKey } const result = await deleteDeployment(env, deploymentId, options) return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] } } catch (error: unknown) { console.error("Error deleting deployment:", error) const errorMessage = error instanceof Error ? error.message : String(error) return { content: [ { type: "text", text: `Error deleting deployment: ${errorMessage}` } ] } } }
- src/index.ts:317-321 (schema)Zod input schema defining parameters for the deleteDeployment tool: deploymentId (required), url/teamId/slug (optional).deploymentId: z.string().describe("The ID of the deployment to delete"), url: z.string().optional().describe("The URL of the deployment"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") },
- src/index.ts:313-348 (registration)Registration of the 'deleteDeployment' tool on the MCP server using server.tool(name, description, inputSchema, handlerFn).server.tool( "deleteDeployment", "Deletes a deployment", { deploymentId: z.string().describe("The ID of the deployment to delete"), url: z.string().optional().describe("The URL of the deployment"), teamId: z.string().optional().describe("Team ID"), slug: z.string().optional().describe("Slug") }, async ({ deploymentId, ...options }) => { try { const env = { VERCEL_API_TOKEN: apiKey } const result = await deleteDeployment(env, deploymentId, options) return { content: [ { type: "text", text: JSON.stringify(result, null, 2) } ] } } catch (error: unknown) { console.error("Error deleting deployment:", error) const errorMessage = error instanceof Error ? error.message : String(error) return { content: [ { type: "text", text: `Error deleting deployment: ${errorMessage}` } ] } } } )
- src/vercel/deployments.ts:217-236 (helper)Helper function that performs the actual deletion using Vercel SDK. Imported and called by the MCP tool handler.export async function deleteDeployment( env: Env, deploymentId: string, options?: { url?: string teamId?: string slug?: string } ) { const vercel = new Vercel({ bearerToken: env.VERCEL_API_TOKEN }) const response = await vercel.deployments.deleteDeployment({ id: deploymentId, ...options }) return MCPResponse(response) }