Skip to main content
Glama

manage_modal_container

Destructive

Run commands inside a running Modal container or terminate it by container ID. Use it for remote execution and stopping containers that need to be cancelled.

Instructions

Act on one running container. Find IDs with
list_modal_resources(resource="containers").

Args:
    action: "exec" — run a command inside the container (`modal container exec`).
        This is arbitrary remote code execution: treat it like SSH, not a lookup.
        "stop" — terminate it (`modal container stop`); in-flight inputs are
        cancelled and rescheduled elsewhere.
    container_id: Container ID ("ta-..."). Unique across environments, so no `env`
        argument is needed (the CLI accepts none for these subcommands).
    command: For "exec": argv list, e.g. ["python", "-c", "print('hi')"] or
        ["ls", "-la", "/"].
    timeout_seconds: For "exec": max seconds to wait. Default 60.
    profile: Modal profile for this call only. Defaults to the active profile.

Returns: exec → {output, returncode, truncated, output_capped}; stop → {message}.

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": {
      "action": "<action>",
      "container_id": "<container_id>"
    },
    "name": "manage_modal_container"
  }
}

Input Schema

NameRequiredDescriptionDefault
actionYes
commandNo
profileNo
container_idYes
timeout_secondsNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.0.1
    • addedInput schema / properties / profile
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Profile"
      +}
  2. Addedv0.2.2

TDQS

A4.7/5.0
Behavior5/5

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

The annotations already declare destructiveHint and openWorldHint, and the description goes further by characterizing exec as arbitrary remote code execution comparable to SSH and by spelling out the side effects of stop (cancelled, rescheduled inputs). It also discloses the return payloads for each action, so the safety and outcome profile is complete.

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 purpose, then a scannable Args block where each line adds real information. Minor redundancy in restating schema defaults (timeout 60, profile default) and in listing the return shape despite an output schema, but nothing is filler.

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 five-parameter mutation tool with no schema descriptions, the definition covers action semantics, ID sourcing, argv format, timeouts, profile overrides, and per-action return values. An agent has everything needed to invoke it correctly without guessing.

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?

With 0% schema description coverage the description carries the full burden and does so: it enumerates both action values, gives container_id format ("ta-...") plus the notable fact that it is environment-unique so no env argument is needed, shows argv examples for command, and states defaults for timeout_seconds and profile.

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 opening line names a specific resource and scope ("Act on one running container") and the action values (exec, stop) pin down exactly what it does. It also routes ID discovery to list_modal_resources(resource="containers"), which cleanly separates it from the sibling listing tool.

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 states the prerequisite for use (obtain container_id via list_modal_resources) and gives the consequence that drives the exec-vs-stop choice: exec is remote code execution, stop cancels and reschedules in-flight inputs. It stops short of explicit exclusions such as when to prefer manage_modal_app instead.

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