Skip to main content
Glama

create_article

Generate and publish blog articles on Emlog by defining title, content, excerpt, tags, cover image, category, draft status, and comment settings through structured input.

Instructions

Create a new blog article

Input Schema

NameRequiredDescriptionDefault
allow_remarkNoWhether to allow comments
contentYesThe content of the article
coverNoThe cover image URL
draftNoWhether to save as draft (y) or publish (n)
excerptNoThe excerpt/summary of the article
sort_idNoThe category ID for the article
tagsNoComma-separated tags for the article
titleYesThe title of the article
topNoWhether to pin to homepage

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "allow_remark": { "description": "Whether to allow comments", "enum": [ "y", "n" ], "type": "string" }, "content": { "description": "The content of the article", "type": "string" }, "cover": { "description": "The cover image URL", "type": "string" }, "draft": { "description": "Whether to save as draft (y) or publish (n)", "enum": [ "y", "n" ], "type": "string" }, "excerpt": { "description": "The excerpt/summary of the article", "type": "string" }, "sort_id": { "description": "The category ID for the article", "type": "number" }, "tags": { "description": "Comma-separated tags for the article", "type": "string" }, "title": { "description": "The title of the article", "type": "string" }, "top": { "description": "Whether to pin to homepage", "enum": [ "y", "n" ], "type": "string" } }, "required": [ "title", "content" ], "type": "object" }

Implementation Reference

  • src/index.ts:162-208 (registration)
    Registration of the 'create_article' MCP tool, including input schema, description, and handler function that delegates to EmlogClient.createArticle
    server.registerTool( "create_article", { title: "Create Article", description: "Create a new blog article", inputSchema: { title: z.string().describe("The title of the article"), content: z.string().describe("The content of the article"), excerpt: z.string().optional().describe("The excerpt/summary of the article"), cover: z.string().optional().describe("The cover image URL"), sort_id: z.number().optional().describe("The category ID for the article"), tags: z.string().optional().describe("Comma-separated tags for the article"), draft: z.enum(["y", "n"]).optional().describe("Whether to save as draft (y) or publish (n)"), top: z.enum(["y", "n"]).optional().describe("Whether to pin to homepage"), allow_remark: z.enum(["y", "n"]).optional().describe("Whether to allow comments") } }, async ({ title, content, excerpt, cover, sort_id, tags, draft, top, allow_remark }) => { try { const result = await emlogClient.createArticle({ title, content, excerpt, cover, sort_id, tags, draft, top, allow_remark }); return { content: [{ type: "text", text: `Successfully created article: ${title} (ID: ${result.article_id || 'unknown'})` }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • Core handler in EmlogClient that executes the API POST request to create a new article via '/?rest-api=article_post' endpoint
    async createArticle(article: { title: string; content: string; excerpt?: string; cover?: string; author_uid?: number; sort_id?: number; tags?: string; draft?: 'y' | 'n'; post_date?: string; top?: 'y' | 'n'; sortop?: 'y' | 'n'; allow_remark?: 'y' | 'n'; password?: string; link?: string; field_keys?: string[]; field_values?: string[]; auto_cover?: 'y' | 'n'; }): Promise<{ article_id: number }> { const formData = this.buildFormData(article); const response = await this.api.post('/?rest-api=article_post', formData); return response.data.data; }
  • Zod input schema defining parameters for the create_article tool, including title, content, optional fields like excerpt, cover, category, tags, draft status, etc.
    inputSchema: { title: z.string().describe("The title of the article"), content: z.string().describe("The content of the article"), excerpt: z.string().optional().describe("The excerpt/summary of the article"), cover: z.string().optional().describe("The cover image URL"), sort_id: z.number().optional().describe("The category ID for the article"), tags: z.string().optional().describe("Comma-separated tags for the article"), draft: z.enum(["y", "n"]).optional().describe("Whether to save as draft (y) or publish (n)"), top: z.enum(["y", "n"]).optional().describe("Whether to pin to homepage"), allow_remark: z.enum(["y", "n"]).optional().describe("Whether to allow comments") }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eraincc/emlog-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server