microcms_delete_content
Delete content from microCMS by specifying the content type and content ID to remove specific items from your CMS database.
Instructions
Delete content from microCMS
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| endpoint | Yes | Content type name (e.g., "blogs", "news") | |
| contentId | Yes | Content ID to delete |
Implementation Reference
- src/tools/delete-content.ts:24-33 (handler)The main handler function that executes the tool logic: validates input and calls the deleteContent helper from client.ts.export async function handleDeleteContent(params: ToolParameters) { const { endpoint, contentId } = params; if (!contentId) { throw new Error('contentId is required'); } await deleteContent(endpoint, contentId); return { message: `Content ${contentId} deleted successfully` }; }
- src/tools/delete-content.ts:5-22 (schema)Tool definition with name, description, and input schema for parameter validation.export const deleteContentTool: Tool = { name: 'microcms_delete_content', description: 'Delete content from microCMS', inputSchema: { type: 'object', properties: { endpoint: { type: 'string', description: 'Content type name (e.g., "blogs", "news")', }, contentId: { type: 'string', description: 'Content ID to delete', }, }, required: ['endpoint', 'contentId'], }, };
- src/server.ts:121-123 (registration)Registration in the server CallToolRequest handler: switch case dispatches to the tool handler.case 'microcms_delete_content': result = await handleDeleteContent(params); break;
- src/server.ts:49-72 (registration)Registration in ListToolsRequest handler: deleteContentTool is included in the tools list (line 63).tools: [ getListTool, getListMetaTool, getContentTool, getContentMetaTool, createContentPublishedTool, createContentDraftTool, createContentsBulkPublishedTool, createContentsBulkDraftTool, updateContentPublishedTool, updateContentDraftTool, patchContentTool, patchContentStatusTool, patchContentCreatedByTool, deleteContentTool, getMediaTool, uploadMediaTool, deleteMediaTool, getApiInfoTool, getApiListTool, getMemberTool, ], }; });
- src/client.ts:84-92 (helper)Supporting utility that performs the actual microCMS API deletion call using the SDK client.export async function deleteContent( endpoint: string, contentId: string ): Promise<void> { return await microCMSClient.delete({ endpoint, contentId, }); }