Skip to main content
Glama

claude_run

Run Claude Code CLI headless in a target working directory to execute multi-step coding, testing, or browser verification tasks, persisting the session ID for later resume.

Instructions

以无头模式(claude -p)调用 Claude Code CLI 在指定工作目录执行多步编码、测试或浏览器验证任务,并持久化会话 ID。

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": {
      "prompt": "<prompt>",
      "cwd": "<cwd>"
    },
    "name": "claude_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdYes目标工作目录绝对路径(必须存在)。
asyncNo可选是否立即异步启动并转后台返回 task_id(等效于 wait_ms: 0)。
modelNo可选目标模型名(例如 codex/gpt-6.2-sol、workbuddy/deepseek-v4-pro)。
effortNo可选推理强度档位(low | medium | high | xhigh | max)。
promptYes交给 Claude Code CLI 执行的完整任务指令。
wait_msNo可选本次调用同步等待时长(毫秒,0~165000,默认 150000 即 2.5 分钟)。超期仍未完成时不会报错也不会杀进程,而是平滑转后台并返回 task_id,避免触发客户端 3 分钟 MCP 超时断线;传 0 表示立即异步返回。
role_nameNo可选成员职能显示名(如"前端开发"、"后端联调"),用于看板主标题展示。
thread_idNo可选工作线 ID,若存在则自动将该任务归入对应 thread。
timeout_msNo可选执行超时时间(毫秒),默认与上限均为 1800000(30 分钟)。
allowed_toolsNo可选允许自动使用的工具列表(传给 --allowedTools)。
permission_modeNo可选权限模式(default 不传该标志;支持 acceptEdits、auto、bypassPermissions、manual、dontAsk、plan)。
append_system_promptNo可选追加系统提示词(传给 --append-system-prompt)。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.0.1

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations, the description carries the full behavioral burden. It does disclose two non-obvious traits: headless CLI invocation and session-ID persistence (enabling later resume). However, it never states that this will actually modify files/run commands in cwd, that it spawns a long-running subprocess, or anything about permissions/cost — significant omissions for a task-executing mutation tool.

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?

A single dense sentence with the mechanism front-loaded and no filler. It is efficient, though for a 12-parameter long-running tool it is arguably under-sized rather than over-sized.

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

Completeness3/5

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

No output schema exists, yet the description does not say what a call returns (task_id vs inline result) or that session persistence is what enables claude_resume. The rich 12-parameter schema compensates for most parameter gaps, but return-shape and long-running semantics remain thin relative to the tool's complexity.

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%, so the schema already explains every parameter including the subtle wait_ms → task_id fallback. The description adds no parameter-level meaning beyond that, so the baseline 3 applies.

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 description names a concrete verb+mechanism (调用 Claude Code CLI 以无头模式 claude -p) plus the resource scope (指定工作目录) and task class (多步编码、测试、浏览器验证). An agent can distinguish this from claude_resume/claude_task_status because it is the entry point that launches work and persists a session ID. It stops short of explicitly contrasting itself with those siblings by name.

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

Usage Guidelines3/5

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

Usage is only implied: 'execute a multi-step coding/testing/verification task' tells the agent this is for launching work, but there is no explicit when-to-use vs claude_resume, claude_task_status, or magpie_ask, and no stated preconditions (e.g. that cwd must contain a project, or that follow-up should go through claude_resume). The sync/async and wait_ms trade-offs live in the schema, not the description.

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