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
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Event document ID | |
| publish | No | true to publish, false to unpublish |
Implementation Reference
- index.js:775-792 (handler)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) }] } }
- index.js:342-349 (schema)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)