Skip to main content
Glama

mp_publish_material

Create WeChat Official Account image messages or articles from a title, cover, body, and inline images; save the result as a draft or publish it with human confirmation.

Instructions

Create one piece of material in the WeChat Official Account console from a title, a cover image and a body, then keep it as a draft or publish it straight from the editor. kind=tietu builds a 贴图 (image message): cover plus any extra images become the gallery, content is the description. kind=article builds a 图文 article: cover is the 封面 chosen through the console's image library (the console has no local cover upload), content is the body, and a line that is just or [[img:/path/to.png]] inserts that local image at that point of the body; author and digest fill 作者 and 摘要. action=draft (default) stops at 草稿箱; action=publish submits from the same editor with the console's own 发表 control, needs confirm=true, and then shows the admin 扫码 page that a human must scan with WeChat. verified=true only when a NEW msgid appears in 发表记录 — for action=publish with wait_publish_s>0 only. Limits, enforced before the browser is touched: • title is required, 1-64 characters as the console counts them (one CJK ideograph is one character); an empty or longer title is rejected with error code -32602 instead of being trimmed. • content is refused above 50000 characters with -32602 (the server's own guard, not a console limit); for tietu it is the description and is clipped to 1000 characters — the reply reports desc_clipped=true; for article it is the body, one paragraph per line, and an inline picture needs a whole line of its own. • author is clipped to 64 characters, digest to 120 — both report clipped/requested_chars. • cover and images must each be a local gif/jpeg/jpg/png/webp file given as an absolute path that exists, at most 10 MB each (raise WXMP_MAX_IMAGE_BYTES to allow bigger files). • for tietu the gallery is cover + images and holds at most 20 pictures; kind=article requires cover, and there images are appended to the body after the text. • action=publish also needs confirm=true and wait_publish_s in 0-900. • kind=article with action=publish is implemented but never submitted against the live console, so treat verified=false there as unproven. Reply fields to branch on: appmsgid (null means no draft id was reported), state=draft|published|pending|unknown, verified, cover_ok (article only; true only when the reopened draft showed the cover), and warning (non-empty means a human should look before publishing).

【中文】用标题、封面图和正文在公众号后台做一份素材,然后存草稿或直接从编辑器发表。kind=tietu 做贴图:封面加上额外图片就是图集,content 是描述。kind=article 做图文:封面走后台的图片库(后台没有本地封面入口),content 是正文,某一行只有 或 [[img:/path/to.png]] 时,就在那里插入这张本地图片;author 和 digest 分别填作者和摘要。action=draft(默认)停在草稿箱;action=publish 用后台自己的发表按钮从同一个编辑器直接提交,需要 confirm=true,之后会出现扫码页,必须由人用微信扫。只有发表记录里出现「新」msgid 才 verified=true——仅限 action=publish 且 wait_publish_s>0 的情况。硬性要求(在碰浏览器之前就校验):• title 必填,1–64 个字符,按后台计数口径(一个汉字算一个);空标题或超长直接返回错误码 -32602,不会悄悄截断。• content:服务端硬上限 50000 个字符;tietu 时是描述,超过 1000 字会被截断,回包给 desc_clipped=true;article 时是正文,一行一段,插图必须单独占一行。• author 超过 64 字截断,digest 超过 120 字截断,回包分别给 clipped / requested_chars。• cover 和 images 里的每一项都必须是本地 gif/jpeg/jpg/png/webp 文件,必须写绝对路径且文件存在,单张最多 10 MB(要更大就调 WXMP_MAX_IMAGE_BYTES)。• tietu 的图集 = cover + images,最多 20 张;kind=article 必须给 cover,images 会接在正文文字之后。• action=publish 还需要 confirm=true,wait_publish_s 取值 0–900。• kind=article 配 action=publish 代码写了但没在真机提交过,那里的 verified=false 只代表未证实。回包该看哪些字段:appmsgid(null 表示没拿到草稿 id)、state=draft|published|pending|unknown、verified、cover_ok(仅图文,只有重开草稿看到封面才为 true)、warning(非空表示发表前该让人看一眼)。

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "kind": "<kind>",
      "title": "<title>"
    },
    "name": "mp_publish_material"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindYesrequired, one of tietu|article: tietu builds a 贴图 image message, article builds a 图文 article. The two open different editors and read different fields, so it has no default / 必填,取值 tietu|article:tietu 做贴图,article 做图文。两者编辑器不同、字段也不同,所以不给默认值
coverNorequired for kind=article, optional for kind=tietu (then it is the gallery's first picture). Must be a local gif/jpeg/jpg/png/webp file given as an absolute path that exists, at most 10 MB each (raise WXMP_MAX_IMAGE_BYTES to allow bigger files) / kind=article 必填,kind=tietu 可省(此时作图集第一张)。必须是本地 gif/jpeg/jpg/png/webp 文件,必须写绝对路径且文件存在,单张最多 10 MB(要更大就调 WXMP_MAX_IMAGE_BYTES)
titleYesrequired, 1-64 characters as the console counts them (one CJK ideograph counts as one). An empty or over-long title is rejected with -32602 and is never trimmed / 必填,1–64 个字符(按后台计数口径,一个汉字算一个)。空标题或超长直接返回 -32602,不会截断
actionNodraft (default) keeps it in 草稿箱 without publishing anything; publish submits from the same editor with the console's own 发表 control and needs confirm=true / draft(默认)只留在草稿箱,什么都不发表;publish 用后台自己的发表按钮从同一个编辑器提交,需要 confirm=truedraft
authorNokind=article only (ignored for tietu): the 作者 field. Not a maxLength in the schema because the code clips instead of refusing: text longer than 64 characters is trimmed and the reply reports clipped=true with requested_chars / 仅 kind=article(tietu 忽略):作者字段。schema 里不设 maxLength,因为行为是截断而不是拒绝:超过 64 字会被裁掉,回包给 clipped=true 和 requested_chars
digestNokind=article only (ignored for tietu): the 摘要 field, trimmed to 120 characters with clipped=true in the reply (no maxLength, so a long value is trimmed rather than refused). Leave it empty and the console scrapes the first characters of the body itself / 仅 kind=article(tietu 忽略):摘要字段,超过 120 字会被裁到该长度,回包给 clipped=true(不设 maxLength,所以长文本是截断不是拒绝)。留空则由后台自己抓正文开头
imagesNoextra pictures, each a local gif/jpeg/jpg/png/webp file given as an absolute path that exists, at most 10 MB each (raise WXMP_MAX_IMAGE_BYTES to allow bigger files). kind=tietu: the gallery is cover + images together and holds at most 20, so with a cover at most 19 entries here. kind=article: they are appended to the body after the text / 额外图片,每个都要是本地 gif/jpeg/jpg/png/webp 文件,必须写绝对路径且文件存在,单张最多 10 MB(要更大就调 WXMP_MAX_IMAGE_BYTES)。kind=tietu:图集 = cover + images,总共最多 20 张,所以给了 cover 时这里最多 19 个。kind=article:接在正文文字之后
confirmNomust be true for action=publish and is ignored for action=draft; publishing is public and cannot be undone / action=publish 时必须为 true,action=draft 时会忽略;发表是公开且不可撤销的
contentNokind=tietu: the description, newlines become paragraphs, clipped to 1000 characters (reply sets desc_clipped=true). kind=article: the body, one paragraph per line; a line holding only ![](/abs/path.png) or [[img:/abs/path.png]] inserts that picture there and the line itself is not typed. Hard cap 50000 characters: longer is rejected with -32602 (a guard against a runaway prompt, not a console limit) / kind=tietu:描述,换行分段,超过 1000 字截断(回包 desc_clipped=true)。kind=article:正文,一行一段;某一行只有 ![](/绝对路径.png) 或 [[img:/绝对路径.png]] 时在该处插图,这一行本身不会作为文字写入。服务端硬上限 50000 字符,超过直接返回 -32602(这是防失控的闸门,不是后台的限制)
screenshotNosave a full-page PNG of the composer to out/ and return its path / 把编辑器的整页 PNG 存到 out/ 并返回路径
wait_publish_sNoaction=publish only, 0-900: how long to poll 发表记录 for the new msgid; 0 skips the poll and answers verified=false at once / 仅 action=publish,取值 0–900:轮询发表记录等新 msgid 的秒数;0 表示不轮询、直接返回 verified=false

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.1/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so thoroughly: validation happens before the browser is touched, error code -32602 is returned rather than silent trimming, clipping is reported via desc_clipped/clipped/requested_chars, and publishing is described as public and irreversible. It even flags that kind=article with action=publish has never been submitted live, so verified=false there is unproven — an unusually candid disclosure.

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

Conciseness3/5

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

The bulleted limits section and the 'reply fields to branch on' list are well front-loaded and scannable. However, the entire description is duplicated in Chinese, roughly doubling its length with no new information for a bilingual-capable agent, which is a substantial conciseness cost for an already long definition.

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

Completeness5/5

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

For an 11-parameter tool with two modes, a browser-driving side effect, and a human-in-the-loop publish step, the definition covers prerequisites, limits, failure codes, and the meaning of every reply field. An output schema exists, so the return-value explanation is technically redundant but reinforces the branch points (appmsgid, state, verified, cover_ok, warning) without harm.

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% and the schema already documents every parameter, including the inline-image line syntax and per-kind cover rules. The description largely restates those constraints; its genuinely additive content (the unproven article+publish path, the warning field) is behavioral rather than parameter semantics. Baseline 3 is appropriate.

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 opening sentence names a specific verb and resource ('Create one piece of material in the WeChat Official Account console from a title, a cover image and a body') and then splits the two modes (kind=tietu vs kind=article) with concrete field mappings. It never names a sibling, though, so an agent still has to guess how this differs from mp_create_tietu or mp_publish_draft, which are the most likely confusions.

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

Usage Guidelines4/5

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

Within-tool guidance is strong: action=draft is the default and stops at 草稿箱, action=publish requires confirm=true and triggers a human 扫码 step, and wait_publish_s=0 is explained as skipping the poll. What is missing is cross-tool routing — nothing says when to prefer this over mp_create_tietu or mp_publish_draft.

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