Skip to main content
Glama
leejersey

Hexo Blog MCP Server

by leejersey

update_post

Modify content or metadata of existing Hexo blog posts to update articles with new text, titles, or tags.

Instructions

修改指定文章的内容或元数据

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filenameYes文章文件名
contentYes新的文章正文内容(Markdown)
titleNo可选,修改标题
tagsNo可选,修改标签

Implementation Reference

  • The core handler logic for updating a post, reading existing front-matter and merging it with new content and provided metadata.
    export async function updatePost(
        filename: string,
        content: string,
        frontMatter?: Record<string, any>
    ): Promise<void> {
        const fullPath = postPath(filename);
    
        // 先读取现有 front-matter
        const raw = await fs.readFile(fullPath, "utf-8");
        const { data: existingData } = matter(raw);
    
        const mergedData = { ...existingData, ...frontMatter };
        const fileContent = matter.stringify(content, mergedData);
        await fs.writeFile(fullPath, fileContent, "utf-8");
    }
  • Registration of the "update_post" tool in the MCP server, defining its schema and mapping input parameters to the updatePost utility.
    // 更新文章
    server.tool(
        "update_post",
        "修改指定文章的内容或元数据",
        {
            filename: z.string().describe("文章文件名"),
            content: z.string().describe("新的文章正文内容(Markdown)"),
            title: z.string().optional().describe("可选,修改标题"),
            tags: z.array(z.string()).optional().describe("可选,修改标签"),
        },
        async ({ filename, content, title, tags }) => {
            try {
                const fm: Record<string, any> = {};
                if (title) fm.title = title;
                if (tags) fm.tags = tags;
                await updatePost(filename, content, Object.keys(fm).length > 0 ? fm : undefined);
                return {
                    content: [{ type: "text" as const, text: `✅ 文章 "${filename}" 已更新。` }],
                };
            } 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?

No annotations are provided, so the description carries the full burden. It states this is a modification tool, implying mutation, but doesn't disclose behavioral traits like whether it overwrites or merges content, what permissions are required, if changes are reversible, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is a significant gap.

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 in Chinese that directly states the tool's purpose. It's front-loaded with the core action and resource, with no wasted words or redundant information. Every part of the sentence earns its place.

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?

Given this is a mutation tool with 4 parameters, no annotations, and no output schema, the description is incomplete. It doesn't cover behavioral aspects (e.g., side effects, error handling), usage context, or return values. The agent lacks critical information to use this tool safely and effectively.

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 4 parameters (filename, content, title, tags) with descriptions. The description adds no additional parameter semantics beyond what's in the schema—it doesn't explain format constraints, interactions between parameters, or default behaviors. Baseline 3 is appropriate when the schema does the heavy lifting.

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 ('修改' meaning modify/update) and the resource ('文章' meaning post/article), specifying it can modify content or metadata. It distinguishes from siblings like create_post (create) and delete_post (delete), but doesn't explicitly differentiate from other modification tools if they existed.

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. It doesn't mention prerequisites (e.g., needing an existing post), when not to use it, or how it differs from similar tools like quick_publish or create_post. The agent must infer usage from the tool 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