Skip to main content
Glama

Run a command on a Mac

exec_mac
DestructiveIdempotent

Runs an argv command on the Mac as the agent user. Waits up to wait_seconds (default 20, max 50): a command that ends in time returns exit_code, stdout and stderr (first 64 KiB each); a longer one returns a job that keeps running (get_mac_job). Shell syntax needs ["/bin/bash", "-lc", "..."]. A command is at most 64 KiB. The same request_key and arguments return the same job, never a second run. A command ends with what it started; ["nomac-service", "start", "api", "--", ...] keeps a server running.

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": {
      "request_key": "<request_key>",
      "argv": "<argv>"
    },
    "name": "exec_mac"
  }
}

Input Schema

NameRequiredDescriptionDefault
cwdNoFolder to run in: relative to the workspace (the default), ~/… or absolute, such as ~/drive/src/app.
argvYesCommand and arguments, for example ["bash", "-lc", "xcodebuild -list"].
session_idNoMac session ID (ses_…). Optional: without it, the account's running Mac.
request_keyYesIdempotency key you choose (8-128 letters, digits and - _ . :). Repeat a lost call with the same key and arguments; a new key is new work.
wait_secondsNoWait this long (0-50, default 20; 40 for builds and tests) for the command to finish and return its output in this call.
timeout_secondsNoStop the command after this many seconds (1-3600, default 300). Builds and test runs: up to an hour.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changed
    • changedInput schema / properties / argv / description
      Previous value: -"Command and arguments as an array, for example [\"bash\", \"-lc\", \"xcodebuild -list\"]. Runs as the agent user in the workspace directory."New value: +"Command and arguments, for example [\"bash\", \"-lc\", \"xcodebuild -list\"]."
    • changedInput schema / properties / cwd / description
      Previous value: -"The folder to run in: relative to the workspace, or ~/… and absolute paths anywhere on the Mac (for example ~/drive/src/app). Default: the workspace."New value: +"Folder to run in: relative to the workspace (the default), ~/… or absolute, such as ~/drive/src/app."
    • changedInput schema / properties / request_key / description
      Previous value: -"Idempotency key you choose: 8-128 letters, digits, dashes, underscores, dots or colons. Retry a lost response with the same key and identical arguments; use a new key for new work."New value: +"Idempotency key you choose (8-128 letters, digits and - _ . :). Repeat a lost call with the same key and arguments; a new key is new work."
  2. Changed2 schema fields changed
    • changedInput schema / properties / session_id / description
      Previous value: -"Mac session ID (ses_…) returned by start_mac or list_mac_sessions."New value: +"Mac session ID (ses_…). Optional: without it, the account's running Mac."
    • changedInput schema / required
      Previous value: -[
      -  "session_id",
      -  "request_key",
      -  "argv"
      -]New value: +[
      +  "request_key",
      +  "argv"
      +]
  3. Changed2 schema fields changed
    • removedInput schema / $schema
      Removed value: -"http://json-schema.org/draft-07/schema#"
    • changedOutput schema / (root)
      Previous value: -{
      -  "$schema": "http://json-schema.org/draft-07/schema#",
      -  "additionalProperties": {},
      -  "description": "The JSON response of the NoMac API for this operation",
      -  "properties": {
      -    "error": {
      -      "additionalProperties": {},
      -      "description": "Present only when the call failed",
      -      "properties": {
      -        "code": {
      -          "description": "Stable machine-readable error code, for example insufficient_credit",
      -          "type": "string"
      -        },
      -        "message": {
      -          "description": "What went wrong and what to do next",
      -          "type": "string"
      -        }
      -      },
      -      "required": [
      -        "code",
      -        "message"
      -      ],
      -      "type": "object"
      -    }
      -  },
      -  "type": "object"
      -}New value: +null
  4. Changed1 schema field changed
    • addedInput schema / properties / cwd
      Added value: +{
      +  "description": "The folder to run in: relative to the workspace, or ~/… and absolute paths anywhere on the Mac (for example ~/drive/src/app). Default: the workspace.",
      +  "maxLength": 1024,
      +  "minLength": 1,
      +  "type": "string"
      +}
  5. Changed3 schema fields changed
    • changedInput schema / properties / timeout_seconds / description
      Previous value: -"Stop the command after this many seconds (1-600, default 300)."New value: +"Stop the command after this many seconds (1-3600, default 300). Builds and test runs: up to an hour."
    • changedInput schema / properties / timeout_seconds / maximum
      Previous value: -600New value: +3600
    • changedInput schema / properties / wait_seconds / description
      Previous value: -"Wait this long (0-50, default 20) for the command to finish and return its output in this call."New value: +"Wait this long (0-50, default 20; 40 for builds and tests) for the command to finish and return its output in this call."
  6. Changed1 schema field changed
    • changedInput schema / properties / request_key / description
      Previous value: -"Idempotency key you choose (letters, digits, dash, underscore). Retry a lost response with the same key and identical arguments; use a new key for new work."New value: +"Idempotency key you choose: 8-128 letters, digits, dashes, underscores, dots or colons. Retry a lost response with the same key and identical arguments; use a new key for new work."
  7. Changed1 schema field changed
    • addedInput schema / properties / wait_seconds
      Added value: +{
      +  "description": "Wait this long (0-50, default 20) for the command to finish and return its output in this call.",
      +  "maximum": 50,
      +  "minimum": 0,
      +  "type": "integer"
      +}
  8. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true, openWorldHint=true and idempotentHint=true, yet the description adds real behavior beyond them: output truncation at 64 KiB per stream, a 64 KiB command size cap, the wait_seconds/timeout_seconds split, and the job-continuation model. The idempotency rule ("the same request_key and arguments return the same job, never a second run") is exactly the kind of detail annotations cannot convey.

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?

It is dense and front-loaded, with the execution model stated before the caveats, and no filler sentences. A few phrasings are telegraphic ("A command ends with what it started") and take a second read, which keeps it below a 5.

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?

There is no output schema, so the description carries the return contract itself, and it does: exit_code, stdout, stderr, truncation limits, and the job handle for timeouts. For a destructive, open-world execution tool with six parameters, nothing an agent needs to call it safely is missing.

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 a baseline of 3 is warranted, but the description adds semantics not present in the field docs: the interaction between wait_seconds and job creation, and the request_key contract for retrying a lost call. cwd, session_id and timeout_seconds are left to the schema, which is acceptable given full coverage.

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 gives a specific verb and resource ("Runs an argv command on the Mac as the agent user") and immediately scopes the execution model: synchronous with exit_code/stdout/stderr, or a background job retrieved via get_mac_job. That differentiates it cleanly from job/session/file siblings such as get_mac_job, read_mac_file, and start_mac.

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?

It tells the agent how to invoke correctly in several concrete cases: shell syntax requires ["/bin/bash", "-lc", "..."], long-running servers need ["nomac-service", "start", ...], and timeouts over wait_seconds route to get_mac_job. It lacks explicit when-not-to-use guidance relative to siblings like read_mac_file or write_mac_file, so a 4 rather than a 5.

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.

Resources