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)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action but doesn't describe what 'publish' or 'unpublish' means operationally (e.g., visibility changes, status updates), whether it's reversible, what permissions are required, or what happens on success/failure. This is inadequate for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise (4 words) and front-loaded with the core action. Every word earns its place, with no wasted text or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, what errors might occur, or behavioral details like side effects. Given the complexity of a publish/unpublish operation, more context is needed for effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already fully documents both parameters (document_id and publish). The description doesn't add any parameter-specific information beyond what's in the schema, such as format examples or edge cases. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('publish or unpublish') and resource ('a blog post'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like strapi_publish_event or strapi_publish_tutorial, which have identical descriptions except for the resource type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing blog post), when to use strapi_update_blog_post instead, or any constraints like permissions or workflow states.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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