strapi_update_blog_post
Modify existing blog posts by updating title, content, description, category, or tags in Strapi CMS using document ID.
Instructions
Update an existing blog post
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| document_id | Yes | Blog post document ID | |
| title | No | New title | |
| content | No | New content in MARKDOWN | |
| description | No | New description | |
| category_id | No | New category ID | |
| tag_ids | No | New tag IDs |
Implementation Reference
- index.js:498-519 (handler)The main handler function that updates an existing blog post in Strapi by constructing a data object from arguments and sending a PUT request to the Strapi Content Manager API endpoint.async updateBlogPost (headers, args) { const data = {} if (args.title) data.title = args.title if (args.content) data.content = args.content if (args.description) data.description = args.description if (args.category_id) data.category = args.category_id if (args.tag_ids) data.tags = args.tag_ids // 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:150-165 (registration)Registers the 'strapi_update_blog_post' tool in the MCP server's listTools response, including name, description, and input schema.{ name: 'strapi_update_blog_post', description: 'Update an existing blog post', inputSchema: { type: 'object', properties: { document_id: { type: 'string', description: 'Blog post document ID' }, title: { type: 'string', description: 'New title' }, content: { type: 'string', description: 'New content in MARKDOWN' }, description: { type: 'string', description: 'New description' }, category_id: { type: 'number', description: 'New category ID' }, tag_ids: { type: 'array', items: { type: 'number' }, description: 'New tag IDs' } }, required: ['document_id'] } },
- index.js:374-375 (handler)Switch case in the CallToolRequestSchema handler that dispatches to the updateBlogPost method for this tool.case 'strapi_update_blog_post': return await this.updateBlogPost(headers, request.params.arguments)
- index.js:154-163 (schema)Defines the input schema for the tool, specifying parameters like document_id (required), title, content, etc.type: 'object', properties: { document_id: { type: 'string', description: 'Blog post document ID' }, title: { type: 'string', description: 'New title' }, content: { type: 'string', description: 'New content in MARKDOWN' }, description: { type: 'string', description: 'New description' }, category_id: { type: 'number', description: 'New category ID' }, tag_ids: { type: 'array', items: { type: 'number' }, description: 'New tag IDs' } }, required: ['document_id']