Skip to main content
Glama

dsh_takeover

Take over a conversation's write lock by identifying its holder: resume if free, kill orphaned service processes, and refuse active or unknown holders unless force is set.

Instructions

抢占会话的写锁(DSH 的写锁是跨进程内核信号量,持有者活着就不过期,没有 API 能直接夺走——唯一手段是杀掉持有者进程,所以本工具会先判定持有者是谁):① 若锁其实空着,正常 resume 即可,不会杀任何东西;② 若持有者是本服务自己留下的孤儿进程(MCP 崩了/重启了,子进程还活着握着锁)→ 自动杀掉并接管,安全;③ 若持有者是另一个活着的 dsh-mcp 实例 → 默认拒绝,传 force=true 才夺;④ 若持有者无法识别(多半是你自己的 DSH GUI 正开着这个会话)→ 绝不杀(那会连你的界面和正在看的对话一起杀掉),只报告,请你在那个窗口里关掉该会话后重试。注意:杀掉正在跑回合的持有者会中断那一轮(会话日志记为 interrupted),会话本体不受损。

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": {
      "conversation_id": "<conversation_id>"
    },
    "name": "dsh_takeover"
  }
}

Input Schema

NameRequiredDescriptionDefault
forceNo仅用于"另一个活着的 dsh-mcp 实例持有"这一种情况;对 GUI/未知持有者无效(永远不杀)。
conversation_idYes会话 id,来自 dsh_start 或 dsh_list。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.7/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: it discloses that the tool may kill a process, precisely which holders are killable versus never killed, the side effect of interrupting a running turn (logged as interrupted), and that the conversation itself is not damaged. This is exactly the destructive-action context an agent needs before invoking.

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?

The destructive decision tree is front-loaded and the numbered branches make the conditional logic scannable. It is long and dense, but nearly every clause conveys a distinct safety-relevant condition; some parenthetical asides could be trimmed.

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 complex, annotation-free destructive tool, the description covers the decision logic and consequences thoroughly. The one gap is the return value: case ④ says it only 'reports', but with no output schema the shape of that report is not described.

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 baseline is 3; the description nonetheless adds real meaning beyond the schema by scoping force to only the 'another live dsh-mcp instance' case and stating it is inert for GUI/unknown holders. conversation_id semantics are left to the schema, which already documents its source.

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 description opens with a specific verb and resource ('抢占会话的写锁') and immediately explains the only mechanism available (killing the holder process). It is plainly distinguishable from siblings like dsh_release or dsh_interrupt because it frames the action as forced takeover with holder detection.

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

Usage Guidelines5/5

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

It enumerates four use cases: the lock is free (use resume instead), the holder is an orphaned child of this service (auto-kill, safe), another live dsh-mcp instance (refuse unless force=true), and an unrecognized holder such as the user's GUI (never kill). Each branch states both when the tool acts and when it refuses, plus the alternative for the free-lock case.

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