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
| Name | Required | Description | Default |
|---|---|---|---|
| contentSiteId | Yes | Content Site ID | |
| reason | No | Reason for deletion |
Implementation Reference
- src/index.ts:919-945 (handler)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, }; } }
- src/index.ts:914-917 (schema)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, }; } } );
- src/index.ts:158-166 (helper)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}`; } }