Skip to main content
Glama

strapi_publish_event

Publish or unpublish events in Strapi CMS by specifying the document ID and publication status.

Instructions

Publish or unpublish an event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
document_idYesEvent document ID
publishNotrue to publish, false to unpublish

Implementation Reference

  • The main handler function for strapi_publish_event. Updates the event's publishedAt field via Strapi Content Manager API to publish (set to current timestamp) or unpublish (set to null).
    async publishEvent (headers, args) {
      const data = {
        publishedAt: args.publish ? new Date().toISOString() : null
      }
    
      const response = await axios.put(
        `${this.strapiUrl}/content-manager/collection-types/api::event.event/${args.document_id}`,
        data,
        { headers }
      )
    
      return {
        content: [{
          type: 'text',
          text: JSON.stringify(response.data, null, 2)
        }]
      }
    }
  • Input schema definition for the strapi_publish_event tool, specifying parameters for document_id and optional publish boolean.
    inputSchema: {
      type: 'object',
      properties: {
        document_id: { type: 'string', description: 'Event document ID' },
        publish: { type: 'boolean', description: 'true to publish, false to unpublish', default: true }
      },
      required: ['document_id']
    }
  • index.js:339-350 (registration)
    Tool registration in ListTools response, including name, description, and full input schema.
    {
      name: 'strapi_publish_event',
      description: 'Publish or unpublish an event',
      inputSchema: {
        type: 'object',
        properties: {
          document_id: { type: 'string', description: 'Event document ID' },
          publish: { type: 'boolean', description: 'true to publish, false to unpublish', default: true }
        },
        required: ['document_id']
      }
    }
  • index.js:418-419 (registration)
    Handler dispatch registration in the CallToolRequest switch statement, routing to publishEvent method.
    case 'strapi_publish_event':
      return await this.publishEvent(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