strapi_update_blog_post
Modify existing blog posts in Strapi CMS by updating title, content, description, category, or tags 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)Implements the core logic for updating a blog post by constructing update data from input arguments and sending a PUT request to Strapi's 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:153-164 (schema)Defines the input schema/validation for the tool, specifying required document_id and optional fields like title, content, description, category_id, and tag_ids.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:150-165 (registration)Tool registration in the ListTools response, defining name, description, and 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 (registration)Dispatch/registration in the CallToolRequest handler switch statement, routing to the updateBlogPost method.case 'strapi_update_blog_post': return await this.updateBlogPost(headers, request.params.arguments)