Skip to main content
Glama

dsh_takeover

Take over a DSH conversation's write lock by identifying the holder: resume if free, kill only orphaned service processes, and refuse live or unknown holders unless forced.

Instructions

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

Input Schema

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

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.8/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 is destructive (kills a process), that killing a holder mid-turn interrupts that turn and marks the log as interrupted while leaving the conversation intact, and that unidentified/GUI holders are never killed. The safety boundary of force=true is also spelled out, which is exactly the kind of context annotations would otherwise supply.

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 numbered case structure (①②③④) is genuinely functional and every clause carries decision-relevant information. It is dense and the long parenthetical in the opening sentence delays the concrete action slightly, so it is not maximally front-loaded, but nothing is redundant.

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 destructive, no-annotation, no-output-schema tool, the description covers the mechanism (kernel semaphore, no revoke API), the failure modes (orphan vs. foreign instance vs. unknown holder), the side effects (interrupted turn, intact conversation), and the user-recovery path. An agent has everything needed to invoke it or correctly abstain.

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% and both params are already documented, hitting the baseline 3, but the description adds real behavioral meaning for force: it applies only to case ③ (another live dsh-any-agent instance) and has no effect on GUI/unknown holders because those are never killed. conversation_id gains nothing beyond the schema, keeping this below a 5.

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 states a specific action on a specific resource: seize the conversation's write lock, explaining that the lock is a cross-process kernel semaphore and that the only takeover mechanism is killing the holder process. It explicitly contrasts itself with the ordinary 'resume' path (case ①), so an agent can tell it is an escalation tool rather than the normal way to attach to a session.

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 exhaustive situations with explicit decisions: free lock → do nothing and resume; orphaned child of this service → kill and take over; another live dsh-any-agent instance → refuse unless force=true; unidentified holder (likely the user's own DSH GUI) → never kill, report and ask the user to close it. When-to-use, when-not-to-use, and the only override are all stated.

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