manage_modal_container
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
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | ||
| command | No | ||
| profile | No | ||
| container_id | Yes | ||
| timeout_seconds | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |