Skip to main content
Glama
leejersey

Hexo Blog MCP Server

by leejersey

create_post

Generate a new blog post for Hexo with title, Markdown content, and tags to publish articles directly from AI clients.

Instructions

创建一篇新的博客文章

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes文章标题
contentNo文章正文内容(Markdown)
tagsNo文章标签列表

Implementation Reference

  • The core implementation of the createPost function, which handles path validation, existence checks, front-matter generation, and writing the markdown file.
    export async function createPost(
        title: string,
        content?: string,
        tags?: string[]
    ): Promise<string> {
        const date = new Date().toISOString().split("T")[0];
        const filename = `${title}.md`;
        const fullPath = postPath(filename);
    
        // 检查是否已存在
        try {
            await fs.access(fullPath);
            throw new Error(`文章 "${filename}" 已存在`);
        } catch (e: any) {
            if (e.code !== "ENOENT") throw e;
        }
    
        const frontMatter: Record<string, any> = { title, date };
        if (tags && tags.length > 0) frontMatter.tags = tags;
    
        const fileContent = matter.stringify(content || "", frontMatter);
        await fs.writeFile(fullPath, fileContent, "utf-8");
    
        return filename;
    }
  • Registration of the 'create_post' MCP tool, including input schema validation using Zod and invocation of the createPost helper.
    // 创建文章
    server.tool(
        "create_post",
        "创建一篇新的博客文章",
        {
            title: z.string().describe("文章标题"),
            content: z.string().optional().describe("文章正文内容(Markdown)"),
            tags: z.array(z.string()).optional().describe("文章标签列表"),
        },
        async ({ title, content, tags }) => {
            try {
                const filename = await createPost(title, content, tags);
                return {
                    content: [
                        {
                            type: "text" as const,
                            text: `✅ 文章已创建: ${filename}\n\n可使用 read_post 查看内容,或使用 preview_blog 在本地预览。`,
                        },
                    ],
                };
            } catch (e: any) {
                return { content: [{ type: "text" as const, text: `错误: ${e.message}` }], isError: true };
            }
        }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It states the tool creates a new blog post, implying a write/mutation operation, but doesn't mention permissions required, whether the post is published immediately, what happens on failure, or any rate limits. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose with zero wasted words. It's appropriately sized for a simple creation tool and front-loads the essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool (creating blog posts) with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after creation (e.g., returns post ID, publishes immediately), error conditions, or how it differs from similar tools like 'quick_publish'. Given the complexity and lack of structured data, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters (title, content, tags) with their descriptions. The description adds no additional parameter information beyond what's in the schema. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('创建一篇新的博客文章' - create a new blog post) and identifies the resource (blog post). It distinguishes from siblings like 'update_post' or 'delete_post' by specifying creation. However, it doesn't explicitly differentiate from 'quick_publish' which might also create posts, making it a 4 rather than a 5.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'quick_publish' or 'update_post'. There's no mention of prerequisites, timing considerations, or differences from sibling tools. The agent must infer usage from the name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/leejersey/hexo-mcp-server'

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