Skip to main content
Glama

microcms_patch_content_status

Update content publication status in microCMS between published and draft states for specific content items using the Management API.

Instructions

Change content publication status in microCMS (Management API). Can change status between PUBLISH (published) and DRAFT (draft). Note: Only transitions between "published" and "draft" are supported.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
endpointYesContent type name (e.g., "blogs", "news")
contentIdYesContent ID to change status
statusYesTarget status: "PUBLISH" to publish content, "DRAFT" to set as draft

Implementation Reference

  • The main handler function that executes the tool logic: validates parameters (endpoint, contentId, status) and calls the client-side patchContentStatus function.
    export async function handlePatchContentStatus( params: ToolParameters & { status: 'PUBLISH' | 'DRAFT' } ) { const { endpoint, contentId, status } = params; if (!endpoint) { throw new Error('endpoint is required'); } if (!contentId) { throw new Error('contentId is required'); } if (!status || (status !== 'PUBLISH' && status !== 'DRAFT')) { throw new Error('status must be either "PUBLISH" or "DRAFT"'); } await patchContentStatus(endpoint, contentId, status); return { message: `Content ${contentId} status changed to ${status}` }; }
  • Tool object definition including name, description, and input schema for parameter validation.
    export const patchContentStatusTool: Tool = { name: 'microcms_patch_content_status', description: 'Change content publication status in microCMS (Management API). Can change status between PUBLISH (published) and DRAFT (draft). Note: Only transitions between "published" and "draft" are supported.', inputSchema: { type: 'object', properties: { endpoint: { type: 'string', description: 'Content type name (e.g., "blogs", "news")', }, contentId: { type: 'string', description: 'Content ID to change status', }, status: { type: 'string', enum: ['PUBLISH', 'DRAFT'], description: 'Target status: "PUBLISH" to publish content, "DRAFT" to set as draft', }, }, required: ['endpoint', 'contentId', 'status'], }, };
  • src/server.ts:47-72 (registration)
    Registers the patchContentStatusTool in the server's list of available tools via ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ getListTool, getListMetaTool, getContentTool, getContentMetaTool, createContentPublishedTool, createContentDraftTool, createContentsBulkPublishedTool, createContentsBulkDraftTool, updateContentPublishedTool, updateContentDraftTool, patchContentTool, patchContentStatusTool, patchContentCreatedByTool, deleteContentTool, getMediaTool, uploadMediaTool, deleteMediaTool, getApiInfoTool, getApiListTool, getMemberTool, ], }; });
  • src/server.ts:115-117 (registration)
    Dispatches the tool call to the handlePatchContentStatus handler in the CallToolRequestSchema switch statement.
    case 'microcms_patch_content_status': result = await handlePatchContentStatus(params as ToolParameters & { status: 'PUBLISH' | 'DRAFT' }); break;
  • Underlying client helper that performs the actual PATCH request to the microCMS Management API to update the content status.
    export async function patchContentStatus( endpoint: string, contentId: string, status: 'PUBLISH' | 'DRAFT' ): Promise<void> { const url = `https://${config.serviceDomain}.microcms-management.io/api/v1/contents/${endpoint}/${contentId}/status`; const response = await fetch(url, { method: 'PATCH', headers: { 'X-MICROCMS-API-KEY': config.apiKey, 'Content-Type': 'application/json', }, body: JSON.stringify({ status: [status] }), }); if (!response.ok) { const errorText = await response.text(); throw new Error(`Failed to patch content status: ${response.status} ${response.statusText} - ${errorText}`); } }

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

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