# MCP tools

> The 20 tools of the flockvm MCP server: VMs, the catalog, SSH keys and environments, with their inputs, annotations and the role each one needs.

- URL: https://flockvm.com/docs/mcp/tools
- Section: MCP server
- Last updated: 2026-11-10

Every tool acts as the API key's user, with their current role, and answers the same JSON as the [API](https://flockvm.com/docs/api): a VM has the same fields in `get_vm` as in `GET /api/v1/vms/{id}`. The answer comes as JSON text and as structured content.

**Read** tools carry `readOnlyHint`; **destructive** ones carry `destructiveHint`, so clients that confirm destructive actions ask first. Every tool says `openWorldHint: false`: they act on your organization's flockvm resources only.

## Account and catalog

| Tool            | What it does                                                                                                                                                                   | Input | Kind |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- | ---- |
| `whoami`        | The user, organization and role the key acts as, and the key's name, prefix and expiry.                                                                                        | none  | read |
| `get_catalog`   | Regions (with the sizes each has room for now, and whether it has environments), sizes with their price per hour, and images (`default: true` marks the one `create_vm` uses). | none  | read |
| `list_ssh_keys` | The SSH public keys saved in the user's account, newest first: their ids go in `create_vm`.                                                                                    | none  | read |

## VMs

| Tool          | What it does                                                                                                                                    | Input                    | Kind        |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | ----------- |
| `list_vms`    | Every VM of the organization, newest first, with status, size, region, SSH command and cost so far. Runner VMs are listed but cannot be driven. | none                     | read        |
| `get_vm`      | One VM, with `ssh.command`, its environment, cost and any error.                                                                                | `id`                     | read        |
| `create_vm`   | Creates and boots a VM.                                                                                                                         | see below                | write       |
| `start_vm`    | Boots a stopped or failed VM: `starting`, then `running`. Billing must be in order.                                                             | `id`                     | write       |
| `stop_vm`     | Shuts a VM down (starting, running, paused or failed): the disk stays, billing stops.                                                           | `id`                     | write       |
| `pause_vm`    | Saves memory and processes to disk, billing stops: `pausing`, then `paused`.                                                                    | `id`                     | write       |
| `resume_vm`   | Brings back a paused VM with its processes, `running` when it answers. Billing must be in order.                                                | `id`                     | write       |
| `delete_vm`   | Deletes a VM and its disk, for good.                                                                                                            | `id`                     | destructive |
| `get_vm_logs` | The last lines of the console log, oldest first.                                                                                                | `id`, `tail` (1 to 1000) | read        |

`id` is the VM's id (`vm_…`), from `list_vms` or `create_vm`.

### create_vm

`name` (string, required): 1 to 40 characters: lowercase letters, digits and dashes, such as `agent-1`.

`size` (string, required): A size from `get_catalog`: `small`, `default`, `large` or `xlarge`. See [Sizes](https://flockvm.com/docs/vms/sizes).

`region` (string, default `gra`): A region id from `get_catalog`. Left out: France (`gra`), the one region today.

`image` (string, default `ubuntu-26.04-agent`): An image id from `get_catalog`: the Agent image by default, `ubuntu-26.04` for Minimal. The Ubuntu 24.04 ids (`ubuntu-24.04-agent`, `ubuntu-24.04`) are refused with an error that names their replacement; VMs created from them before 2026-11-01 still show them in `list_vms` and `get_vm`.

`ssh_key_id` (string): The id (`key_…`) of a key saved in the account, from `list_ssh_keys`. Give this or `ssh_public_key`.

`ssh_public_key` (string): An OpenSSH public key, such as `ssh-ed25519 AAAA… agent@laptop`. The agent needs the matching private key to connect.

`save_key` (boolean, default `false`): With `ssh_public_key`: also save the key to the account.

`environment` (string): An environment id or name, or `"none"`. Left out: the organization's default environment. Every region.

`env` (object): This VM's own variables, over the environment's: `{"KEY": "value"}`. Every region.

The new VM comes back with status `starting`. It turns `running` within seconds: call `get_vm` until it does, then connect with its `ssh.command`. The rules are the dashboard's: see [Create a VM](https://flockvm.com/docs/vms/create).

## Environments

| Tool                 | What it does                                                                                                                | Input                                                | Kind        | Role         |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | ----------- | ------------ |
| `list_environments`  | Every environment, the default first, with variable names and last 4 characters, file paths and sizes.                      | none                                                 | read        | any          |
| `get_environment`    | One environment: switches, variables, files, GitHub repositories, versions.                                                 | `environment`                                        | read        | any          |
| `create_environment` | Creates an empty environment.                                                                                               | `name`                                               | write       | owner, admin |
| `set_env_var`        | Adds or replaces a variable (value up to 32 KiB). The value is never shown again.                                           | `environment`, `key`, `value`                        | write       | owner, admin |
| `delete_env_var`     | Removes a variable.                                                                                                         | `environment`, `key`                                 | destructive | owner, admin |
| `set_env_file`       | Adds or replaces a secret file at `~/<path>` in new VMs, as text (`content`) or base64 (`content_base64`), 256 KiB at most. | `environment`, `path`, `content` or `content_base64` | write       | owner, admin |
| `delete_env_file`    | Removes a secret file.                                                                                                      | `environment`, `path`                                | destructive | owner, admin |
| `delete_environment` | Deletes an environment with its variables and files. Not the default one.                                                   | `environment`                                        | destructive | owner, admin |

`environment` is an id (`env_…`) or a name. A change makes a new version of the environment: VMs keep the version they were created with. There is no tool to read a value back. See [Environments](https://flockvm.com/docs/vms/environments) and [What it never does](https://flockvm.com/docs/mcp/overview#what-it-never-does).

## Errors

A refused call comes back as a tool error (`isError: true`) with the API's code, the field when there is one, and the reason. A member's key calling `set_env_var` gets:

```text
forbidden: Only owners and admins can change environments.
```

A refusal about one input names it: `bad_request (field: name): …`. The structured content is the API's error body, `{"error": {"code", "message", "field"}}`. The codes are the API's: `bad_request`, `forbidden`, `not_found`, `conflict`, `capacity` (no room on the host now: for this size on `create_vm`, for this VM on `start_vm`, `resume_vm` or `pause_vm`), `unavailable` (retry), `not_configured`, `internal`. See [API overview](https://flockvm.com/docs/api/overview#errors).

An input the tool's own schema refuses (a wrong type, a field it does not take, a string too long) never reaches flockvm. It comes back from the MCP library as a tool error with its plain text, and no code, field or structured content:

```text
Input validation error: Invalid arguments for tool get_vm: …
```

Read the text for the argument at fault, fix it and call again.
