Skip to main content
Glama

Run command

command_run
DestructiveIdempotent

Use this when the user asks to run a command on the approved computer, such as a build, test, Git, package manager or PowerShell command, including commands that only inspect state. Full Access uses the user account's rights; scoped grants keep their restrictions. timeoutMs is the process lifetime, up to 24 hours; a long command returns its running IDs in about two seconds, then follow it with operation_status/operation_output and stop it with operation_cancel. Do not use to scan or probe hosts other than this computer (port scans, host discovery, vulnerability checks); decline those instead. Needs the sessionId from execution_session_open and a new operationId; each call is metered as one execution. A short result is returned inline within about two seconds; otherwise keep the returned IDs for operation_status and operation_output and do not resend the call.

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": {
      "sessionId": "<sessionId>",
      "operationId": "<operationId>",
      "command": "<command>"
    },
    "name": "command_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoWorking folder relative to the selected project root (or the workspace root); omit for the root. Other tools in that folder wait while the command runs, so start a long-running server without cwd
argsNoArguments as separate strings
commandYesExecutable name or path, for example node, npm, git or powershell
sessionIdYesexecutionSessionId returned by execution_session_open
timeoutMsNoProcess lifetime limit in ms, 100-86400000 (default 60000; with interactive 86400000)
deadlineAtNoOptional UTC admission deadline at most 60 seconds ahead (queue start timeout, NOT process execution lifetime)
interactiveNotrue: keep the program's input open, for a REPL (python -i, node -i), ssh or another program that reads input; send it lines with operation_input and read its replies there. Output stays readable with operation_output. Without timeoutMs the program may run up to 24 hours; idleTimeoutMs or operation_cancel ends it sooner (optional)
operationIdYesA new random UUID v4 for this call; reuse it only to retry this same call
idleTimeoutMsNoWith interactive: stop the program after this long with no output and no input, 1000-86400000 ms (default 600000) (optional)
idempotencyKeyNoOptional retry key, 8-128 chars of [A-Za-z0-9._:-]; defaults to operationId
efficiencyProfileNoOptional, unverified label of the client's model, recorded as display metadata in the device owner's local activity statistics. Omit when unknown. Never send credentials or conversation content.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / cwd / description
      Previous value: -"Working folder relative to the selected project root (or the workspace root); omit for the root"New value: +"Working folder relative to the selected project root (or the workspace root); omit for the root. Other tools in that folder wait while the command runs, so start a long-running server without cwd"
  2. Changed4 schema fields changed
    • addedInput schema / properties / idleTimeoutMs
      Added value: +{
      +  "description": "With interactive: stop the program after this long with no output and no input, 1000-86400000 ms (default 600000) (optional)",
      +  "maximum": 86400000,
      +  "minimum": 1000,
      +  "type": "integer"
      +}
    • addedInput schema / properties / interactive
      Added value: +{
      +  "const": true,
      +  "description": "true: keep the program's input open, for a REPL (python -i, node -i), ssh or another program that reads input; send it lines with operation_input and read its replies there. Output stays readable with operation_output. Without timeoutMs the program may run up to 24 hours; idleTimeoutMs or operation_cancel ends it sooner (optional)",
      +  "type": "boolean"
      +}
    • removedInput schema / properties / timeoutMs / default
      Removed value: -60000
    • changedInput schema / properties / timeoutMs / description
      Previous value: -"Process lifetime limit in ms, 100-86400000 (default 60000)"New value: +"Process lifetime limit in ms, 100-86400000 (default 60000; with interactive 86400000)"
  3. Changed3 schema fields changed
    • changedInput schema / properties / deadlineAt / pattern
      Previous value: -"^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"New value: +"Z$"
    • removedInput schema / properties / operationId / pattern
      Removed value: -"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
    • removedInput schema / properties / sessionId / pattern
      Removed value: -"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
  4. First observed

TDQS

A4.9/5.0
Behavior5/5

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

Annotations declare destructive=true and openWorldHint=true, and the description adds genuinely non-obvious context beyond them: permission model (Full Access uses the user account's rights, scoped grants keep their restrictions), metering (one execution per call), the ~2 second inline-vs-async return split, and timeoutMs as process lifetime up to 24 hours. It also discloses the safe-retry contract via operationId reuse, which complements idempotentHint rather than contradicting it.

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?

Front-loaded with the use case, then constraints, then the async follow-up flow — the ordering an agent needs. It is long but justified by an 11-parameter destructive tool; the only waste is the near-duplication between "a long command returns its running IDs in about two seconds" and the closing sentence restating the same inline-vs-ID rule.

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, open-world, 11-parameter execution tool with no output schema, the definition covers prerequisites, permission scope, lifetime limits, return-shape expectations, follow-up tools, retry semantics and explicit exclusions. Nothing an agent needs in order to call it correctly and handle the result is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is already 100%, so the baseline would be 3; the description still adds cross-parameter meaning the schema states only locally — timeoutMs is the process lifetime (not a response wait), long commands return running IDs quickly, and interactive sessions are continued via operation_input/operation_output. It also clarifies the sessionId/operationId provenance, which the schema notes but the description frames as a required workflow.

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 names a concrete verb and resource ("run a command on the approved computer") and enumerates the domains it covers: build, test, Git, package manager, PowerShell, including read-only inspection commands. It is clearly separable from siblings because it routes follow-up work to operation_status/operation_output/operation_cancel rather than implying it does polling or cancellation itself.

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 states both when to use (user asks to run a build/test/git/package/PowerShell command, including state inspection) and when not to (host scanning, port scans, host discovery, vulnerability checks — decline instead). It also names the prerequisite flow (sessionId from execution_session_open, fresh operationId) and the correct alternative path for long commands (status/output then cancel), plus the anti-pattern of resending the call.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.