Skip to main content
Glama

deleteSite

Remove a Netlify site by providing its ID or name to manage your deployment environment.

Instructions

Delete a site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
siteIdYesID or name of the site to delete

Implementation Reference

  • 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;
      }
    }
  • 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'],
      },
    },

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/MCERQUA/netlify-mcp'

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