strapi_create_blog_post
Create new blog posts in Strapi CMS with markdown content, author assignment, and category/tag organization.
Instructions
Create a new blog post in Strapi CMS with markdown content
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| title | Yes | Blog post title | |
| content | Yes | Blog post content in MARKDOWN format | |
| description | No | Short description/excerpt | |
| author_id | Yes | Author ID (use strapi_list_authors to find) | |
| category_id | No | Category ID (use strapi_list_categories) | |
| tag_ids | No | Array of tag IDs (use strapi_list_tags) | |
| publishedAt | No | Publication date (ISO 8601) or null for draft |
Implementation Reference
- index.js:436-459 (handler)The createBlogPost method that executes the tool logic: constructs the post data from arguments and sends a POST request to Strapi's blog-post collection endpoint, returning the response.async createBlogPost (headers, args) { const data = { title: args.title, content: args.content, description: args.description, author: args.author_id, category: args.category_id, tags: args.tag_ids, publishedAt: args.publishedAt || null } const response = await axios.post( `${this.strapiUrl}/content-manager/collection-types/api::blog-post.blog-post`, data, { headers } ) return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] } }
- index.js:108-120 (schema)Input schema for the strapi_create_blog_post tool, defining parameters like title, content (markdown), author_id (required), etc.inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Blog post title' }, content: { type: 'string', description: 'Blog post content in MARKDOWN format' }, description: { type: 'string', description: 'Short description/excerpt' }, author_id: { type: 'number', description: 'Author ID (use strapi_list_authors to find)' }, category_id: { type: 'number', description: 'Category ID (use strapi_list_categories)' }, tag_ids: { type: 'array', items: { type: 'number' }, description: 'Array of tag IDs (use strapi_list_tags)' }, publishedAt: { type: 'string', description: 'Publication date (ISO 8601) or null for draft' } }, required: ['title', 'content', 'author_id'] }
- index.js:105-121 (registration)Tool registration in the ListTools handler, specifying name, description, and input schema for strapi_create_blog_post.{ name: 'strapi_create_blog_post', description: 'Create a new blog post in Strapi CMS with markdown content', inputSchema: { type: 'object', properties: { title: { type: 'string', description: 'Blog post title' }, content: { type: 'string', description: 'Blog post content in MARKDOWN format' }, description: { type: 'string', description: 'Short description/excerpt' }, author_id: { type: 'number', description: 'Author ID (use strapi_list_authors to find)' }, category_id: { type: 'number', description: 'Category ID (use strapi_list_categories)' }, tag_ids: { type: 'array', items: { type: 'number' }, description: 'Array of tag IDs (use strapi_list_tags)' }, publishedAt: { type: 'string', description: 'Publication date (ISO 8601) or null for draft' } }, required: ['title', 'content', 'author_id'] } },
- index.js:365-367 (handler)Switch case in CallToolRequest handler that dispatches to the createBlogPost method.case 'strapi_create_blog_post': return await this.createBlogPost(headers, request.params.arguments)