Skip to main content
Glama

session_run

Execute a command in an existing persistent session and wait for its result, so the same environment can be reused across commands and output reviewed before choosing the next step.

Instructions

在已有的常驻会话里执行一条命令,并等待结果返回。这是「多次命令复用同一环境」的正确用法:每次可以看完输出再决定下一条。

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": {
      "session": "<session>",
      "issueNumber": "<issueNumber>",
      "command": "<command>"
    },
    "name": "session_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
commandYes要执行的命令(可多行)
sessionYessession_start 返回的 session id
timeoutMsNo等待结果的毫秒数,默认 30 分钟
issueNumberYessession_start 返回的 issueNumber
artifactPathsNo命令跑完后要收集的产物路径(支持通配,多行)。例如 "app/build/outputs/apk/debug/*.apk"。产物会作为 Release 资产上传并返回下载链接,不写入 git 历史,所以反复出包也不会撑大仓库。

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior2/5

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

With no annotations at all, the definition bears the full burden, and all it discloses is that execution is synchronous ('等待结果返回') and resumable across commands. It says nothing about what happens on timeout, whether output is truncated, whether commands run through a shell, permission requirements, or failure semantics — critical for a blocking command-execution 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?

Two short sentences with the core action front-loaded and zero redundant restatement of the schema. The second sentence leans slightly rhetorical ('这是……的正确用法') rather than purely operational, but it is not wasteful.

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?

It establishes the prerequisite (a session created elsewhere, per the schema's session_start references) and the blocking/reuse model, which is the essential mental model. Given no output schema and no annotations for a command-execution tool, the absence of timeout, truncation, and error behavior leaves real gaps.

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% with five documented parameters, so the schema already carries session/issueNumber provenance, timeout defaults, and the artifact-upload behavior. The description adds no parameter-level detail beyond restating that the session must pre-exist; baseline 3 is appropriate.

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 definition uses a concrete verb phrase ('执行一条命令') tied to a specific resource and scope ('已有的常驻会话'), which makes the contrast with session_start (creates the session) and with a one-off run tool reasonably inferable. It stops short of naming an alternative tool explicitly, so the differentiation is implied rather than stated.

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?

The second sentence states the situation in which this tool is the intended choice: '多次命令复用同一环境', with the inspect-output-then-decide loop. There is no explicit exclusion such as 'for a single command in a fresh environment, use run instead', so the agent must infer the negative case.

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