strapi_create_blog_post
Create blog posts in Strapi CMS by providing title, markdown content, author ID, and optional metadata like categories and publication date.
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 main handler function that executes the tool logic: constructs the blog post data and sends a POST request to Strapi's content-manager API to create the post.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:105-121 (schema)Defines the tool's metadata including name, description, and input schema with required fields and types.{ 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-366 (registration)Registers the tool in the CallToolRequestSchema handler by switching on the tool name and delegating to the createBlogPost handler method.case 'strapi_create_blog_post': return await this.createBlogPost(headers, request.params.arguments)