Skip to main content
Glama

更新文档(乐观锁)

gwl_update_document
Idempotent

Update a document's title, content, summary, folder, visibility, or permissions with version-based conflict detection and base-content merging to handle concurrent edits.

Instructions

更新文档:至少要提供一个可变字段(title/content/summary/icon/folder_id/permission_bits/visibility/owning),否则本工具直接报参数错误而不发请求。 并发安全:强烈建议先 gwl_get_document_by_id 拿到 version 并原样传入;版本不符返回 409,且 data 带 current_version / expected_version / editor_username。 base_content 表示「你准备改动的那份原文」,必须与 content 同时提供,服务端据此自动合并他人改动。 重复提交同样内容返回 msg=无变更(幂等)。revision_summary 是这次修订的说明。

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": {
      "doc_id": "<doc_id>"
    },
    "name": "gwl_update_document"
  }
}

Input Schema

NameRequiredDescriptionDefault
iconNo
titleNo
doc_idYes文档 id(路径参数)。
owningNo
contentNo
summaryNo
versionNo乐观锁基线版本;来自 gwl_get_document_by_id 的 version。省略=不做版本校验。
folder_idNo移动到指定文件夹(0=根目录)。
visibilityNo
base_contentNo准备改动的原文基线;必须与 content 同时提供。
permission_bitsNo
revision_summaryNo本次修订说明(写进修订历史),最多 200 个字符。

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

Beyond the annotations it discloses concrete runtime behavior: a 409 on version mismatch with current_version / expected_version / editor_username in the payload, validation failure occurring before any request is sent, server-side merging of concurrent edits when base_content is paired with content, and a 'no change' message on repeat submission. That is far more than the idempotentHint/destructiveHint flags convey.

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?

Four short, front-loaded sentences, each carrying distinct information (field requirement, concurrency protocol, merge semantics, idempotency). The field enumeration in the first sentence is long but functional; no filler or restatement of the name.

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

Completeness4/5

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

For a 12-parameter mutation tool this covers the essential hazards: required inputs, locking protocol, merge path and error payloads, and an output schema exists so return values need not be spelled out. It does not mention authorization prerequisites beyond what the schema's owning description implies (403), which is a minor gap.

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 only 42%, but the description compensates by defining cross-parameter semantics the schema cannot express: the at-least-one-of field rule, version as an optimistic-lock baseline sourced from gwl_get_document_by_id, base_content's mandatory pairing with content, and revision_summary's role as the changelog note. It still leaves the format nuance of fields like permission_bits and owning to the schema, so it is not exhaustive.

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?

The first sentence names a specific verb+resource (update document) plus the operative constraint that at least one mutable field must be supplied, and the title signals the optimistic-locking mechanism. An agent can distinguish this from gwl_create_document / gwl_delete_document / gwl_restore_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?

It gives explicit preconditions (at least one mutable field, else a parameter error with no request sent) and an explicit recommended workflow (call gwl_get_document_by_id first and pass version through unchanged). It does not say when to prefer a different tool, e.g. revision restore vs. field update, so it stops short of full alternative routing.

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