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 main handler function `publishBlogPost` that takes headers and arguments, constructs a data object with `publishedAt` set to current ISO timestamp if publish is true or null otherwise, performs a PUT request to the Strapi API endpoint for the specific blog post document, and returns the response data as text.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:169-176 (schema)Input schema for the tool defining the expected arguments: `document_id` (required string) and `publish` (boolean with default true). No output schema defined.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:166-177 (registration)Registration of the tool in the MCP server's tools list, including name, description, and input schema.{ 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)Dispatch case in the request handler switch statement that routes calls to this tool to the `publishBlogPost` method.case 'strapi_publish_blog_post': return await this.publishBlogPost(headers, request.params.arguments)