Tools reference
Every tool the Legion MCP server offers, what it changes, which ones ask before they act, and how arguments, errors and limits work.
Each tool runs one operation of the Legion API as you, with your permissions in the organization, whether Claude is connected by signing in or the client uses an API key. The tool list is generated from the API's description, so the tools, their summaries and which ones ask first always match it. The For column says who a tool is for: Renting tools are on every key an agent uses, and Hosting tools are for providers (audience: provider in the API's description) and are offered only to a key made with provider tools, or a connection approved as Agent + hosts. For any other Agent key or connection the server does not list them, and calling one is refused as an unknown tool.
The tools
| Tool | For | What it does | Effect | Asks you first | Reference |
|---|---|---|---|---|---|
estimate_ | Renting | What a backup of this rental would cost | Read only | No | GET / |
estimate_ | Renting | What downloading a rental's workspace export will cost | Read only | No | GET / |
get_ | Renting | Get a backup | Read only | No | GET / |
get_ | Renting | Get the organization's balance | Read only | No | GET / |
get_ | Renting | Get the caller | Read only | No | GET / |
get_ | Renting | Get one offer with its score breakdown and uptime history | Read only | No | GET / |
get_ | Renting | Get a rental | Read only | No | GET / |
get_ | Renting | Get what a rental has cost | Read only | No | GET / |
get_ | Renting | The host a rental runs on, its health and its GPUs' live telemetry | Read only | No | GET / |
get_ | Renting | Read a rental's logs | Read only | No | GET / |
get_ | Renting | The rental's effective network policy and whether its host applied it | Read only | No | GET / |
get_ | Renting | Get a service | Read only | No | GET / |
get_ | Renting | Read a service's logs, every replica | Read only | No | GET / |
get_ | Renting | A service's inference metrics | Read only | No | GET / |
get_ | Renting | The organization's spend by one dimension | Read only | No | GET / |
get_ | Renting | The organization's spend over a period, with the previous period | Read only | No | GET / |
get_ | Renting | How long a stopped rental's files are kept, and what backups cost | Read only | No | GET / |
get_ | Renting | Get a workspace export | Read only | No | GET / |
inspect_ | Renting | Inspect a container image before renting it | Read only | No | POST / |
list_ | Renting | The organization's backups, newest first | Read only | No | GET / |
list_ | Renting | List what happened to the organization's balance or earnings | Read only | No | GET / |
list_ | Renting | List Legion's starter images and premade models, and which a host can run | Read only | No | GET / |
list_ | Renting | List the caller's offer alerts | Read only | No | GET / |
list_ | Renting | Search GPU offers | Read only | No | GET / |
list_ | Renting | The organization's registry credentials | Read only | No | GET / |
list_ | Renting | A rental's backups, newest first | Read only | No | GET / |
list_ | Renting | List what the organization's rentals have cost | Read only | No | GET / |
list_ | Renting | List the organization's rentals | Read only | No | GET / |
list_ | Renting | A service's activity | Read only | No | GET / |
list_ | Renting | List the organization's services | Read only | No | GET / |
list_ | Renting | The organization's rentals that were charged in a period | Read only | No | GET / |
list_ | Renting | List the caller's saved SSH public keys | Read only | No | GET / |
add_ | Renting | Save a registry credential | Changes data | Yes | POST / |
add_ | Renting | Save an SSH public key | Changes data | Yes | POST / |
cancel_ | Renting | Cancel a queued or uploading backup | Changes data | No | POST / |
cancel_ | Renting | Cancel a pending workspace export | Changes data | Yes | POST / |
create_ | Renting | Be emailed once when a matching machine is available | Changes data | No | POST / |
create_ | Renting | Create a service key | Changes data | Yes | POST / |
delete_ | Renting | Delete an offer alert | Changes data | No | DELETE / |
export_ | Renting | Export a stopped rental's workspace | Changes data | No | POST / |
rotate_ | Renting | Rotate a service key | Changes data | Yes | POST / |
update_ | Renting | Change a rental's settings | Changes data | Yes | PATCH / |
backup_ | Renting | Back up a stopped or failed rental's workspace | Spends credit | Yes | POST / |
create_ | Renting | Mint a download link for a ready backup | Spends credit | Yes | POST / |
create_ | Renting | Rent GPUs on a host | Spends credit | Yes | POST / |
create_ | Renting | Create a service | Spends credit | Yes | POST / |
create_ | Renting | Make a single-use download link for a ready workspace export | Spends credit | Yes | POST / |
start_ | Renting | Restart a stopped rental | Spends credit | Yes | POST / |
update_ | Renting | Change a service's model, hardware, scaling or budget, or switch autoscaling on or off | Spends credit | Yes | PATCH / |
delete_ | Renting | Delete a ready backup early | Deletes or stops | Yes | DELETE / |
delete_ | Renting | Delete a rental and its workspace | Deletes or stops | Yes | DELETE / |
delete_ | Renting | Delete a service | Deletes or stops | Yes | DELETE / |
remove_ | Renting | Remove a registry credential | Deletes or stops | Yes | DELETE / |
revoke_ | Renting | Revoke a service key | Deletes or stops | Yes | DELETE / |
stop_ | Renting | Stop a rental | Deletes or stops | Yes | POST / |
get_ | Hosting | The organization's earnings over a period, with the previous period | Read only | No | GET / |
get_ | Hosting | Get a host | Read only | No | GET / |
get_ | Hosting | A host's network state and the abuse flags raised on its rentals | Read only | No | GET / |
get_ | Hosting | Preview what is on a host before removing it | Read only | No | GET / |
get_ | Hosting | What Legion recommends the host charge per GPU-hour | Read only | No | GET / |
get_ | Hosting | Get the organization's provider earnings | Read only | No | GET / |
get_ | Hosting | Get what a rental on one of the organization's hosts has earned | Read only | No | GET / |
list_ | Hosting | Hosts that are earning less than they could, with what to do | Read only | No | GET / |
list_ | Hosting | What each of the organization's hosts earned and how it performed | Read only | No | GET / |
list_ | Hosting | A host's benchmark runs, newest first | Read only | No | GET / |
list_ | Hosting | A host's GPU benchmark runs, newest first | Read only | No | GET / |
list_ | Hosting | List the organization's hosts | Read only | No | GET / |
list_ | Hosting | The organization's maintenance windows | Read only | No | GET / |
preview_ | Hosting | What scheduling maintenance would do | Read only | No | GET / |
cancel_ | Hosting | Cancel scheduled maintenance windows | Changes data | Yes | POST / |
end_ | Hosting | End active maintenance windows now ("done with maintenance") | Changes data | Yes | POST / |
rename_ | Hosting | Rename a host | Changes data | Yes | PUT / |
reschedule_ | Hosting | Move or change scheduled maintenance windows | Changes data | Yes | POST / |
schedule_ | Hosting | Schedule maintenance on one or many hosts | Changes data | Yes | POST / |
update_ | Hosting | Set a host's price and availability | Changes data | Yes | PUT / |
remove_ | Hosting | Remove a host | Deletes or stops | Yes | POST / |
The last column links to the API operation the tool runs. Its page has every parameter and response.
What the columns mean
Read only tools change nothing. They are safe to let an agent call freely.
Changes data tools create or change something. They are
add_, which saves a registry credential for private images,registry_ credential add_, which saves an SSH key that later rentals can use,ssh_ key export_, which packs a stopped rental'sworkspace /into a file kept for 24 hours (making it is free; each download link is charged, see below),workspace cancel_, which stops a pending export and discards its upload,workspace_ export cancel_, which cancels a queued or uploading backup, discards its upload and refunds it,backup update_, which changes an interruptible rental's max price per GPU-hour, whether it resumes by itself, whether it backs up automatically or which SSH key opens it (the old key stops working within about a minute), and the Service toolsrental create_, which makes a service key, andservice_ key rotate_, which replaces one, and the Hosting toolsservice_ key update_, which sets a host's price and whether it is offered,host_ listing rename_, and the maintenance toolshost schedule_,maintenance reschedule_,maintenance cancel_andmaintenance end_, which announce, move, call off or end a maintenance window and email the renters on the host, and the Renting toolsmaintenance create_, which asks Legion to email you once when a machine matching a search becomes available (an offer alert), andoffer_ alert delete_, which takes one back.offer_ alert Spends credit tools charge your credit. They are
create_, which starts billing and can turn on the automatic backup of an interruptible rental,rental start_, which starts billing,rental backup_, which makes a backup of a stopped or failed rental, kept for 7 or 30 days,rental create_, which makes a download link for a backup: the first is included in its price, and each further one is charged, andbackup_ download_ link create_, which makes a download link for a ready workspace export: $0.15 per GiB of the file, every link. A download link works once. The Service toolsworkspace_ export_ download_ link create_andservice update_expose a port of a rental or start replicas that spend credit, up to the service's monthly cap.service Deletes or stops tools end something. They are
stop_,rental delete_,rental remove_, which removes a registry credential,registry_ credential delete_, which deletes a backup early with no refund, and the Hosting toolbackup remove_, which cannot be undone. The Service toolshost delete_andservice revoke_end a service and cut off a key.service_ key Back up and stop, or back up then delete:
stop_andrental delete_withrental backup_also make a backup and charge its price, so the agent states that price, fromretention_ days estimate_, and asks first. The preview ofbackup stop_andrental delete_presents both choices side by side: stop or delete without a backup (the default, unless the rental backs up automatically) and back up first with its price, and the agent asks which one the user wants.rental Hosting tools are
list_,hosts get_,host list_,host_ benchmarks list_,host_ gpu_ benchmarks get_,host_ network get_,price_ recommendation get_,provider_ earnings get_,earnings_ overview list_,earnings_ by_ host list_,earnings_ attention get_,rental_ earnings update_,host_ listing rename_,host get_,host_ removal_ preview remove_,host list_,maintenance_ windows preview_,maintenance schedule_,maintenance reschedule_,maintenance cancel_andmaintenance end_. They read your hosts, their benchmarks and network state, what a removal would meet (the renters' files stored on the host), the price Legion recommends, your earnings and how your hosts are performing, and change a host's price, listing and name, or remove it. The maintenance tools read a host's windows and what a new window would do (maintenance preview_, which writes nothing), and schedule, move, cancel or end one: the preview before a yes names the hosts, the start and planned end, whether each is penalty-free, and how many renter organizations and rentals are emailed. A host change also needs an organization owner's key.maintenance Asks you first is Yes for a tool that does nothing until the agent passes
confirm: true, and the agent should only do that after you said yes. It is No for a tool that only reads.
Arguments
| Argument | Type, and the tools that take it | What it does |
|---|---|---|
| Path and query parameters | Every tool whose operation has them | The operation's own parameters are top-level arguments with the same names. For example list_ takes gpu_, min_, sort, limit and cursor. The API's own pages list them. |
body | Every tool whose operation has a request body | The request body goes in this one argument. |
idempotency_ | Required string, on create_, create_ and create_ | The operation takes an Idempotency-Key. The key is at most 255 characters. The agent makes a new one for each thing it means to do and reuses it when it retries that same thing, so a retry never rents twice. See Idempotency. |
confirm | Boolean, on every tool that asks first | true once you have said yes. Without it the tool only returns a preview. |
expected_ | Integer, on create_ and start_ | The price per GPU-hour, in cents, that you agreed to. Required when confirm is true. If the price has changed, the call is refused and you are shown the current price. |
expected_ | Integer, on create_ | The hourly total, in cents, from the preview (the price per GPU-hour times the number of GPUs). Required when confirm is true. It ties your yes to the GPU count as well as the price. |
confirm_ | String, on delete_ | Required when confirm is true. It must equal the rental's name, so a mistaken ID can't delete the wrong rental. |
confirm_ | String, on update_, rename_ and remove_ | Required when confirm is true. It must equal the host's current name, so a mistaken ID can't change or remove the wrong host. |
confirm_ | Boolean, on update_ | Required (true) when the new price is under half the current one, after you said yes to that cut. Without it the call is refused with price_. |
stored_ | String in body, on remove_ | when_ ("Remove when empty") or delete_ ("Delete renters' files and remove now"). Required when the host holds renters' files, else the call is refused with host_. Read get_ first and offer both. delete_ also needs body. and body. (the host's name, as the user typed it, besides the top-level confirm_), after the user said yes to deleting the files. |
confirm_ | Boolean, on remove_ | Required with body. true, after you said yes to forcing: rentals stranded on the offline host end as failed. Without it the call is refused with invalid_. |
expected_ | Integer, on update_ | The new price per GPU-hour, in cents, equal to body. in USD. Required when confirm is true. A mismatch is refused, so a price typed in dollars where cents belong is caught. |
How asking first works
A tool that asks first does nothing when confirm is missing. Instead it returns a preview with the code confirmation_. For create_, the preview shows the price, your balance, the SSH key and the image. For a host tool it shows the host's name and state and what the change does: the old and new price and what a new rental earns you, that the old name is never assigned again, or that removing the host revokes its credentials and that the machine comes back only by enrolling again as a new host. The agent shows you the preview, and calls again with confirm: true only if you say yes.
{
"name": "create_rental",
"arguments": {
"idempotency_key": "6f1c2b8e-3d4a-4f5e-9b7c-2a1d0e8f9c3b",
"body": {
"host_id": "8c0e2f4a-1b3d-4e5f-9a7b-6c5d4e3f2a1b",
"gpu_count": 1,
"image": "pytorch/pytorch:2.4.0-cuda12.4-cudnn9-runtime",
"ssh_public_key": "ssh-ed25519 AAAA… you@laptop"
}
}
}This call has no confirm, so it creates nothing. It returns the preview. After your yes, the agent sends the same call with confirm: true and expected_ and expected_ set to the values in the preview.
confirm is a safeguard against mistakes. It can't stop an agent that has been manipulated into passing it. Your client's own approval prompt can. See Safety.
Results
A successful call returns the API's JSON, as structured content and as text.
Errors
When the API refuses a call, the result is marked as an error and carries the problem: code, title, detail, status and request_. The agent should branch on code, as with the API. Every API code is in Errors. Quote the request_ when you contact support.
The server adds a few codes of its own:
| Code | What it means |
|---|---|
confirmation_ | The tool asks first and confirm was missing. Nothing was done. The result is the preview. |
price_ | expected_ or expected_ does not match the current price, or expected_ does not equal the new listing price. Nothing was created or changed. |
price_ | From create_: the host's price changed after the check, before the GPUs were reserved. Nothing was created. current_ is the new price. |
name_ | confirm_ is not the rental's name, or confirm_ is not the host's current name. Nothing was deleted or changed. |
price_ | From update_: the new price is under half the current one and confirm_ was missing. Nothing was changed. Show the cut and ask again. |
invalid_ | An argument is missing or wrong, for example confirm: true without expected_. detail says which. Nothing was done. |
secret_ | The answer contained a credential, so the server withheld it. The agent should not try to get the value another way. Use the Legion app. |
response_ | The answer is too large for an agent. The agent narrows the request with filters, limit and cursor. |
rate_ | The key made too many calls. Wait, then try again. |
Limits
Each API key or connected app can make 120 MCP requests a minute. Each API key can make 20 rental creations or restarts an hour. Each organization can make 60 rental creations or restarts an hour, over all its keys.
The API's own limits apply to the tools too: for example, checking images is limited per organization. Over a limit the result has the code
rate_. See Rate limits.limited Lists return a page at a time. The agent passes
next_back ascursor cursor. See Pagination.
Hints for clients
Every tool carries hints that clients can use: read tools are marked read only, and tools that remove or widen access are marked destructive. A client may ask for your approval before a tool call. Leave that on for any tool that isn't read only.
Service tools
A service is a public URL for something you run on Legion: a port on one of your rentals, or a model that Legion runs on rented GPUs and scales with traffic. The tools that manage services are in the table above (list_, get_, create_, update_, delete_, create_, rotate_, revoke_, get_ and list_). They run the service operations of the Legion API as you, with the same permissions (services. and services.). What each does:
get_shows the Service URL, access, mode, status, scaling, cap, replicas, a usage summary and the keys (masked).service create_works in either mode: on a rental (a port of one of your rentals) or autoscaled (a model or image). Withoutservice confirmit returns a preview with the estimate: the likely hardware, its price, the range, the cost per hour idle, at the minimum and at the maximum, and the cap.update_changes scaling, the price ceiling or cap, the access (public or API key required, and the allowed addresses) and the mode (turn autoscaling on or off), or pauses and resumes withservice paused: trueorfalse.delete_deletes the service and its keys. For a service on a rental the rental is untouched. Deleting an autoscaled service needs a fresh sign-in, so it is refused withservice step_: use the app.up_ required
Things to know:
Configuration.
create_,rental create_andservice update_takeservice env,model_, and, for your own image,settings commandandargs. Previews and events show variable names and whether each is secret, never a secret's value, and the preview says when a change restarts the container or rolls the replicas. An agent never asks you to type a secret into the chat: save it in the app or withlegion --secret-env. See Configuration.create_withrental servealso returns theservice_of the service it creates.id Making a service public removes the key check. For an autoscaled service it also lets anyone with the Service URL drive scale-up, up to its maximum replicas and cap. The preview says so, and the agent asks you first. The preview of
create_for an autoscaled model carries the estimate: the likely hardware, its price and the range.service A key's secret is a credential.
create_(with an API key required),service create_andservice_ key rotate_return the new key's secret once, in the answer. The agent gives it to you to store, and doesn't print it again, write it to a file or put it in a URL. Legion keeps only a fingerprint, so it can't be shown again.service_ key Changes need a Full access key. An Agent key, and an app connected by signing in, can only read services (
list_,services get_,service get_,service_ metrics list_). A change answersservice_ events 403 api_: make it in the app, or use a Full access API key with the MCP server.key_ scope Asks first works as for every other tool: without
confirm: truethe tool returns a preview and changes nothing. The agent passesconfirm: trueonly after your yes, in your latest message.
Registry credentials
list_ lists the organization's saved credentials for private images (name, host, path prefix, username, last used), never a token. add_ and remove_ ask first, like every tool that changes things, and need the registry. permission, which owners have. Don't paste a token into the chat: save it in Settings, Registry credentials, or with legion registry add. See Private images.
What isn't a tool
Adding credit, payouts, API keys, invitations and enrollment tokens are not tools. Enrolling a host needs an enrollment token, which is a secret that adds a machine to your organization, so you run the installer on the machine yourself from Add a host in the app. A host's blocked networks are a provider security control and stay in the app, and so do egress requests and the web terminal. Use the Legion app for them. Managing existing hosts is possible only with the Hosting tools, on a key made with provider tools. Connecting to a rental is ssh, which the agent runs in a shell, not an MCP tool: see Connecting.