deleteSite
Remove a Netlify site by providing its ID or name to manage your deployment environment.
Instructions
Delete a site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | ID or name of the site to delete |
Implementation Reference
- src/index.ts:356-392 (handler)Handler implementation for the deleteSite tool. Validates the siteId argument, performs a DELETE request to the Netlify API endpoint `/sites/${siteId}`, and returns a success message or appropriate error.case 'deleteSite': { const args = request.params.arguments as unknown as DeleteSiteArgs; if (!args?.siteId) { throw new McpError( ErrorCode.InvalidParams, 'Missing required parameter: siteId' ); } try { await this.axiosInstance.delete(`/sites/${args.siteId}`); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: `Site ${args.siteId} deleted successfully`, }, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { if (error.response?.status === 404) { throw new McpError( ErrorCode.InvalidParams, `Site not found: ${args.siteId}` ); } throw new McpError( ErrorCode.InternalError, `Failed to delete site: ${this.formatNetlifyError(error)}` ); } throw error; } }
- src/index.ts:44-46 (schema)TypeScript interface defining the input arguments for the deleteSite tool, requiring a siteId string.interface DeleteSiteArgs { siteId: string; }
- src/index.ts:181-194 (registration)Tool registration in the listTools response, including name, description, and input schema for deleteSite.{ name: 'deleteSite', description: 'Delete a site', inputSchema: { type: 'object', properties: { siteId: { type: 'string', description: 'ID or name of the site to delete', }, }, required: ['siteId'], }, },