Skip to main content
Glama

apply_actions

Apply document edit actions (nodes, content, styles, geometry, slides, find-replace) and return per-action success or rejection reasons; use documentId to update or a document/path to create a copy.

Instructions

对文档应用一串编辑动作(与编辑器 UI 同一归约器,语义完全一致),返回每个动作是否生效(changes)和没生效的原因(reasons,与 changes 一一对应:没改动时是 null,被拒时写清哪个键、哪条规则)。用 documentId 时就地更新这份文档(version 加一),传 document / documentPath 时另存为一份新文档并返回它的 documentId;动作里图片 src 写成本机文件路径的会读进来嵌入。常用:node/insert-children(插入节点)、node/update-content(改字/改数据元素内容)、node/update-style(改样式)、node/update-geometry(改位置尺寸)、slide/*(页的增删换序)、document/find-replace(整套查找替换)、document/restyle(整套换配色字体)。每个动作的完整写法见 get_guide("actions")。文档怎么写见 dingcard://schema/freeform 资源或 get_guide("document-model")。

Input Schema

NameRequiredDescriptionDefault
actionsYesFreeformAction 数组
documentNo完整的 v44(或 v1–43 旧版)文档 JSON,可替代 documentId
documentIdNo创建或修改文档的工具返回的 documentId(推荐:不必来回传整份文档)
documentPathNo文档 JSON 文件的路径,可替代 documentId
includeDocumentNo同时返回完整文档 JSON(默认只返回 documentId 和 version)

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/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 load and does so: it discloses the return contract (changes array plus one-to-one reasons, null when nothing changed, which key/rule caused rejection), the two persistence modes and version increment, and the side effect of embedding local image files. That is unusually complete for a mutation tool with zero annotation coverage.

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

Conciseness4/5

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

Core behavior and the two save modes are front-loaded, then the action catalog and guide pointers. The common-action enumeration is long but functional. Minor compression opportunity in the reasons explanation, which is slightly verbose.

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 a complex mutation tool with a freeform actions array and no output schema, the description supplies the return shape, persistence semantics, and pointers to the authoritative action and document-model guides. Nothing essential to a correct first call is missing.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds real meaning the schema does not: documentId means in-place update versus document/documentPath meaning save-as-new, and that image src as a local path gets embedded. includeDocument is left to the schema, which is acceptable.

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

Purpose5/5

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

States a specific verb+resource: apply a batch of edit actions to a document, evaluated by the same reducer used by the editor UI. The mutation/scoping story is explicit enough that an agent can distinguish it from get_document, validate_document, or render_document without opening any schema.

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?

Gives clear mode-selection guidance: documentId edits in place (version bumps), document/documentPath writes a new document and returns its documentId. It also routes the agent to get_guide("actions"), get_guide("document-model"), and the dingcard://schema/freeform resource for syntax. No explicit 'do not use this when…' exclusion against a named sibling, so it stops just short of a 5.

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