deleteSite
Remove a Netlify site by specifying its unique site ID using the MCP Server, enabling efficient site management and cleanup within the Netlify environment.
Instructions
Delete a site
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| siteId | Yes | ID of the site to delete |
Implementation Reference
- src/index.ts:356-392 (handler)The main handler logic for the 'deleteSite' tool. Validates the siteId parameter, performs the API DELETE request to Netlify, handles errors like 404 for not found, and returns a success response.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.interface DeleteSiteArgs { siteId: string; }
- src/index.ts:181-194 (registration)Registration of the 'deleteSite' tool in the ListTools response, including name, description, and input schema.{ name: 'deleteSite', description: 'Delete a site', inputSchema: { type: 'object', properties: { siteId: { type: 'string', description: 'ID or name of the site to delete', }, }, required: ['siteId'], }, },