strapi_publish_blog_post
Publish or unpublish a blog post in Strapi CMS by specifying the document ID and desired publication status.
Instructions
Publish or unpublish a blog post
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Blog post document ID | |
| publish | No | true to publish, false to unpublish |
Implementation Reference
- index.js:521-539 (handler)The core handler function that publishes or unpublishes a blog post by updating the 'publishedAt' field via a PUT request to the Strapi content manager API endpoint.async publishBlogPost (headers, args) { const data = { publishedAt: args.publish ? new Date().toISOString() : null } // Strapi 5 uses documentId for single document operations const response = await axios.put( `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post/${args.document_id}`, data, { headers } ) return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] } }
- index.js:166-177 (schema)The tool schema definition including name, description, and input schema for validation.{ name: 'strapi_publish_blog_post', description: 'Publish or unpublish a blog post', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Blog post document ID' }, publish: { type: 'boolean', description: 'true to publish, false to unpublish', default: true } }, required: ['document_id'] } },
- index.js:377-378 (registration)Registration in the CallToolRequestSchema switch statement that routes calls to the publishBlogPost handler.case 'strapi_publish_blog_post': return await this.publishBlogPost(headers, request.params.arguments)
- index.js:166-177 (registration)Tool registration in the ListToolsRequestSchema response, exposing the tool to MCP clients.{ name: 'strapi_publish_blog_post', description: 'Publish or unpublish a blog post', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Blog post document ID' }, publish: { type: 'boolean', description: 'true to publish, false to unpublish', default: true } }, required: ['document_id'] } },