Skip to main content
Glama

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
NameRequiredDescriptionDefault
document_idYesBlog post document ID
publishNotrue to publish, false to unpublish

Implementation Reference

  • 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) }] } }
  • 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)

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/AINative-Studio/ainative-strapi-mcp-server'

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