Skip to main content
Glama

compose_exec

Run commands inside a running Docker Compose service container. Specify service and argv, with options for user, workdir, env, and project files.

Instructions

Run a command inside an already-running compose service container (see also container_exec).

Always passes -T (no TTY). Pass an exec-form argv (e.g. ["python", "-V"]); a ["sh", "-c", "..."] form interprets shell metacharacters in untrusted substrings. Does not raise on a non-zero CLI exit (a missing compose plugin or a timeout still raises) - inspect returncode/stderr in the result.

Args: service: Service name from the compose file command: Argv to execute inside the container project_dir: Dir with the compose file (default: server cwd; copied to the target host if no local plugin) files: Explicit compose file paths (repeatable, -f) project_name: Compose project name override index: Container index when the service has multiple replicas workdir: Working directory inside the container user: User to run as inside the container (uid or name) env: Environment variables to set for the exec session timeout_seconds: Subprocess timeout (default 60s)

Returns: dict: {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNo
userNo
filesNo
indexNo
commandYes
serviceYes
workdirNo
project_dirNo
project_nameNo
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.9.0

TDQS

A4.8/5.0
Behavior5/5

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

Goes beyond the generic readOnlyHint/destructiveHint annotations by disclosing that -T is always passed, that non-zero CLI exits do not raise exceptions, that exec-form argv avoids shell interpolation, and which failure modes still raise. These are material behavioral details an agent needs to interpret results correctly.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-factored: opening purpose, then critical execution notes, then an Args list, then Returns. Each sentence earns its place—no fluff, no repetition of schema types. The front-matter covers the most important operational caveats before the parameter list.

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?

Given 10 parameters foreseeable, no schema descriptions, no output schema, and nested object inputs, this description provides all essential context: command form, error behavior, parameter meanings, default values, and return structure. There is no missing information required to invoke the tool correctly.

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?

The input schema has 0% description coverage, so the description must fully compensate. It provides concise, meaningful descriptions for all 10 parameters, including defaults, semantics like 'repeatable, -f', and context such as 'container index when service has multiple replicas'. This gives the agent everything needed to populate each parameter correctly.

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?

States a specific verb and resource: 'Run a command inside an already-running compose service container'. The qualifier 'already-running' distinguishes it from compose_run and container_run, and it explicitly points to the sibling container_exec. This is a precise, unambiguous purpose statement.

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?

Provides clear context by specifying the target is an already-running compose service, which implies not for stopping containers or non-compose containers. Mentions 'see also container_exec' but does not explicitly state when to choose one over the other. This is clear context without formal exclusions.

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

Deploy Server

Other Tools