Skip to main content
Glama

delete_content_site

Remove content sites from the Kapiti platform by specifying the site ID and deletion reason to manage website content operations.

Instructions

Delete a content site

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentSiteIdYesContent Site ID
reasonNoReason for deletion

Implementation Reference

  • Handler function that executes the delete_content_site tool logic: sends DELETE request to `/tools/content-sites/${contentSiteId}` with optional reason payload, returns API response or error.
    async ({ contentSiteId, reason }) => {
      try {
        const payload = { reason };
        const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/content-sites/${contentSiteId}`, {
          data: payload,
        });
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response.data, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: handleApiError(error),
            },
          ],
          isError: true,
        };
      }
    }
  • Zod input schema defining parameters: contentSiteId (string, required), reason (string, optional).
    inputSchema: {
      contentSiteId: z.string().describe("Content Site ID"),
      reason: z.string().optional().describe("Reason for deletion"),
    },
  • src/index.ts:909-946 (registration)
    Registration of the 'delete_content_site' tool with McpServer, including title, description, input schema, and handler function.
    server.registerTool(
      "delete_content_site",
      {
        title: "Delete Content Site",
        description: "Delete a content site",
        inputSchema: {
          contentSiteId: z.string().describe("Content Site ID"),
          reason: z.string().optional().describe("Reason for deletion"),
        },
      },
      async ({ contentSiteId, reason }) => {
        try {
          const payload = { reason };
          const response: AxiosResponse<ApiResponse> = await apiClient.delete(`/tools/content-sites/${contentSiteId}`, {
            data: payload,
          });
    
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response.data, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: handleApiError(error),
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper function used in the handler for formatting API error responses.
    function handleApiError(error: any): string {
      if (error.response) {
        return `API Error ${error.response.status}: ${error.response.data?.message || error.response.statusText}`;
      } else if (error.request) {
        return "Network Error: Unable to reach API server";
      } else {
        return `Error: ${error.message}`;
      }
    }

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/Headlesshost/mcp-server'

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