Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Adapt Platform CLI

`adapt` is the command-line client for [Adapt Platform](https://platform.adapt.com).
It manages sandboxes, runs commands, transfers files, and calls connected tools.
It manages sandboxes, runs commands, and transfers files.

## Install

Expand Down Expand Up @@ -190,28 +190,6 @@ Download a file from a sandbox:
adapt files get SANDBOX_ID /tmp/output.txt ./output.txt
```

## Call connected tools

Find tools on your connected Model Context Protocol (MCP) services:

```sh
adapt connections search "files"
```

In the following commands, replace `CONNECTION_ID` and `TOOL_NAME` with values from the search results.
Show the tool's input schema:

```sh
adapt connections describe CONNECTION_ID TOOL_NAME
```

Put the required arguments in `arguments.json`.
Then call the tool:

```sh
adapt connections call CONNECTION_ID TOOL_NAME --arguments @arguments.json
```

## Install the skill

Install the Adapt skill for Codex, Claude Code, Pi, and OpenCode:
Expand Down
15 changes: 1 addition & 14 deletions docs/api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Based on the resource OpenAPI document from `../platform` at `f20ded3`, plus its
auth integrations. The `query` filter on `GET /v1/sandboxes` and the `name` and `status`
filters on `GET /v1/images` come from platform `2396647`. `GET /v1/sandboxes/{id}/usage`
comes from platform `d3b6c77`. The model routes come from platform `8747699`.
Platform removed the external-tool gateway in [PR #308](https://github.com/adapt/platform/pull/308).
Every resource operation has a named command, except model provider writes (`POST`, `PUT`,
and `DELETE` on `/v1/model-gateway/providers`); configure providers in the Platform dashboard.
`adapt api METHOD PATH` also exposes same-origin JSON requests for less common account operations.
Expand Down Expand Up @@ -64,20 +65,6 @@ one from the CLI, or reuse the UUID supplied with `--idempotency-key`.
| `GET /v1/models` | `models list` |
| `GET /v1/model-gateway/providers` | `models providers` |
| `GET /v1/model-gateway/providers/{id}/models` | `models discover ID` |
| `POST /v1/gateway/connections` | `connections create --data JSON` |
| `GET /v1/gateway/connections` | `connections list` |
| `GET /v1/gateway/connections/{id}` | `connections get ID` |
| `PUT /v1/gateway/connections/{id}` | `connections update ID --data JSON` |
| `DELETE /v1/gateway/connections/{id}` | `connections delete ID` |
| `POST /v1/gateway/connections/{id}/refresh` | `connections refresh ID` |
| `PUT /v1/gateway/connections/{id}/grants` | `connections grant ID --data JSON` |
| `POST /v1/gateway/connections/{id}/oauth` | `connections oauth ID` |
| `POST /v1/gateway/connections/{id}/oauth/complete` | `connections oauth-complete ID --data JSON` |
| `GET /v1/gateway/connections/{id}/calls` | `connections calls ID` |
| `GET /v1/gateway/principals` | `connections principals` |
| `GET /v1/gateway/search` | `connections search QUERY` |
| `POST /v1/gateway/describe` | `connections describe ID TOOL` |
| `POST /v1/gateway/call` | `connections call ID TOOL --arguments JSON` |
| `POST /mcp` (JSON-RPC `tools/list`) | `mcp tools [NAME]` |

Auth commands use `/v1/auth/device/code`, `/device/token`, `/get-session`, and `/sign-out`.
Expand Down
14 changes: 2 additions & 12 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`.
| `images` | `list`, `get`, `import`, `pull`, `wait`, `delete` |
| `env` | `list`, `get`, `create`, `update`, `delete` |
| `registry` | `list`, `create`, `update`, `delete` |
| `connections` | `list`, `get`, `create`, `update`, `delete`, `refresh`, `grant`, `oauth`, `oauth-complete`, `calls`, `principals`, `search`, `describe`, `call` |
| `models` | `list`, `providers`, `discover` |
| `keys` | `list`, `create`, `delete` |
| `sessions` | `list`, `revoke`, `revoke-others` |
Expand All @@ -53,7 +52,6 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`.
| `profiles` | Show saved API URLs, organizations, and credential status |
| `api` | Send an authenticated request to a path on the selected API server |

`connections` manages upstream MCP services.
`mcp list` and `mcp revoke` manage clients with permission to connect to Platform.
`mcp tools` lists the tools that Platform's own MCP server provides.
Named commands do not cover internal compute administration, OAuth provider internals, or calling tools through `/mcp`.
Expand Down Expand Up @@ -532,7 +530,7 @@ On the cloud backend, these resources accept full UUIDs or unique ID prefixes:
- Sandboxes and executions.
- Images and registry credentials.
- Volumes and endpoints.
- Environment variable sets and tool connections.
- Environment variable sets.
- Model providers.

This also applies to references such as `--image-id`, `--credential`, and both IDs in an endpoint binding.
Expand All @@ -557,7 +555,7 @@ Use full IDs in scripts.
The Platform API must support resource ID prefixes.

Authentication and organization commands require exact identifiers.
This includes `--org`, members, invitations, keys, sessions, and grant principals.
This includes `--org`, members, invitations, keys, and sessions.
`org use` accepts a full organization ID or an exact slug.
Pagination cursors, idempotency keys, and credential tokens also require exact values.

Expand All @@ -568,10 +566,6 @@ The `--data` option accepts a JSON object, `@file.json`, or `-` for stdin.
```sh
adapt registry create --data @registry-credential.json
adapt env update VARIABLE_SET_ID --data @variable-patch.json
adapt connections create --data '{"name":"Tools","url":"https://tools.example.com/mcp","authType":"oauth"}'
adapt connections oauth CONNECTION_ID
adapt connections search "files"
adapt connections call CONNECTION_ID read_file --arguments '{"path":"/report.txt"}'
```

Updates require these fields:
Expand All @@ -580,7 +574,6 @@ Updates require these fields:
| --- | --- |
| Registry credential | All credential fields and the current `version` |
| Environment variable set | `name`, `version`, and `env`; use null values to remove variables |
| Tool connection | `version`, `name`, `enabled`, and `allowedTools` |

Platform validates request data and permissions.
It reports conflicts and unsupported operations.
Expand Down Expand Up @@ -623,10 +616,7 @@ If you use `--cursor` to request each page yourself, supply the same filters wit

Resource lists use cursor pagination.
Use `--all` to retrieve all pages.
Connection lists and call history use a page size that the server sets.
Do not supply `--limit` for those commands.
Member and API-key lists use `--offset` with pages of 50 entries.
Tool search returns a `nextOffset` value for the next page.

## Output and retries

Expand Down
33 changes: 5 additions & 28 deletions skills/adapt/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
---
name: adapt
description: >-
Use the adapt CLI to manage Adapt Platform sandboxes, run remote commands,
transfer files, and discover or execute tools from connected MCP servers.
Use when the user asks to work with Platform resources or their connected tools.
Use the adapt CLI to manage Adapt Platform resources, run commands in
sandboxes, transfer files, and inspect Platform's built-in MCP tools.
---

# Adapt Platform

Use `adapt COMMAND --help` for exact arguments. `adapt skill show` prints this
guide offline. Discover resource IDs with list/search commands rather than guessing.
Core resource selectors (sandboxes, executions, images, registries, volumes,
endpoints, variable sets, and tool connections), including linked IDs such as
endpoints, and variable sets), including linked IDs such as
`--image-id`, `--credential`, and both IDs in `endpoints bind`, accept full UUIDs or
unambiguous hexadecimal prefixes.
Platform resolves them within the caller's authorized scope; ambiguity returns
Expand Down Expand Up @@ -122,26 +121,6 @@ must listen on `0.0.0.0`. Endpoint tokens authenticate the hosted app with
sends only `-H` headers plus the endpoint token from `--token`/`--new-token`,
never follows redirects, and exits 1 after printing the body of a non-2xx response.

## Connected MCP tools

```sh
adapt connections list --all --json
adapt connections search "slack channels"
adapt connections describe CONNECTION_ID TOOL_NAME
adapt connections call CONNECTION_ID TOOL_NAME --arguments @arguments.json
```

Search finds tools across the user's connections. Describe the chosen tool to
get its input schema before constructing arguments; provider tool names and
schemas vary. `--arguments` accepts a JSON object inline, `@file.json`, or `-`
for stdin. Use the returned connection ID and exact tool name.

For Slack, discover the channel-listing tool, inspect its schema, and call it
to resolve a channel name to its ID. When posting is requested, discover and
describe the message-posting tool and use that channel ID. Listing channels is
a separate action from sending a message. Inspect tool results for reported
errors as well as the CLI exit status.

## Models

```sh
Expand All @@ -165,8 +144,7 @@ adapt mcp tools TOOL_NAME
`mcp tools` lists the built-in tools of Platform's own MCP server, and
`mcp tools TOOL_NAME` prints one tool's input schema. It requires an organization
API key (`adapt auth login --token-stdin` or `ADAPT_TOKEN`); browser sign-in
sessions are refused. These are not the user's connected tools; use
`connections search` for those. `mcp list` shows authorized MCP clients, not tools.
sessions are refused. `mcp list` shows authorized MCP clients.

## Output, pagination, and retries

Expand All @@ -175,8 +153,7 @@ and log commands stream raw output unless `--json` is supplied, in which case
they emit newline-delimited events. Progress and idempotency keys go to stderr.

Resource listings return objects such as `{"sandboxes": [...], "nextCursor": ...}`.
Use `--all` to follow cursor pages. Tool search uses `--offset` and its returned
`nextOffset`; connection listings have a server-defined page size.
Use `--all` to follow cursor pages.

JSON API reads retry transient connection and gateway failures with backoff,
honoring `Retry-After` within the original `--timeout` budget. Readiness waits keep
Expand Down
8 changes: 1 addition & 7 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,9 @@ impl Api {
path: &str,
field: &str,
page: &Page,
supports_limit: bool,
filters: &[(String, String)],
) -> Result<Value> {
let mut query = Vec::new();
if supports_limit {
query.push(("limit".into(), page.limit.unwrap_or(50).to_string()));
} else if page.limit.is_some() {
bail!("This endpoint has a fixed page size; omit --limit");
}
let mut query = vec![("limit".into(), page.limit.unwrap_or(50).to_string())];
// Filters apply to every page; following pages replace only the cursor.
query.extend_from_slice(filters);
if let Some(cursor) = page.cursor {
Expand Down
2 changes: 1 addition & 1 deletion src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub fn now() -> u64 {
.as_secs()
}

pub fn open_browser(url: &str) -> Result<()> {
fn open_browser(url: &str) -> Result<()> {
validate_http_url(&Url::parse(url)?)?;
#[cfg(target_os = "macos")]
let mut command = Command::new("open");
Expand Down
2 changes: 1 addition & 1 deletion src/backend/cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Backend for CloudBackend<'_> {
.map(|text| ("query".into(), text.clone()))
.collect::<Vec<_>>();
self.0
.list("/v1/sandboxes", "sandboxes", &args.page, true, &filters)
.list("/v1/sandboxes", "sandboxes", &args.page, &filters)
.await
}
async fn sandbox_get(&self, id: ResourceRef) -> Result<Value> {
Expand Down
67 changes: 0 additions & 67 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ pub enum Command {
/// Manage private registry credentials
#[command(subcommand)]
Registry(RegistryCommand),
/// Manage upstream MCP connections and call tools
#[command(subcommand)]
Connections(ConnectionCommand),
/// Inspect model providers and the enabled model catalog
#[command(subcommand, visible_alias = "model")]
Models(ModelCommand),
Expand Down Expand Up @@ -656,70 +653,6 @@ pub enum RegistryCommand {
},
}

#[derive(Subcommand)]
pub enum ConnectionCommand {
#[command(visible_alias = "ls")]
List(Page),
Get {
id: ResourceRef,
},
/// JSON: name, url, authType (none/bearer/oauth), optional token and visibility
Create(Data),
/// JSON: version, name, enabled, allowedTools, optional token
Update {
id: ResourceRef,
#[command(flatten)]
data: Data,
},
Delete {
id: ResourceRef,
},
Refresh {
id: ResourceRef,
},
/// JSON: principalType (mcp/apiKey), principalId, tools
Grant {
id: ResourceRef,
#[command(flatten)]
data: Data,
},
/// Open upstream authorization in a browser
Oauth {
id: ResourceRef,
#[arg(long)]
no_browser: bool,
},
/// Complete upstream authorization with JSON: code, state, optional iss
OauthComplete {
id: ResourceRef,
#[command(flatten)]
data: Data,
},
Calls {
id: ResourceRef,
#[command(flatten)]
page: Page,
},
Principals,
Search {
#[arg(default_value = "")]
query: String,
#[arg(long, default_value_t = 0)]
offset: u32,
},
Describe {
connection: ResourceRef,
tool: String,
},
Call {
connection: ResourceRef,
tool: String,
/// Tool argument object: inline JSON, @file, or -
#[arg(long, default_value = "{}")]
arguments: String,
},
}

#[derive(Subcommand)]
pub enum KeyCommand {
#[command(visible_alias = "ls")]
Expand Down
39 changes: 5 additions & 34 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,18 @@ pub async fn run(cli: Cli) -> Result<u8> {
| Command::Volumes(_) | Command::Endpoints(_) | Command::Images(_)) =>
return resources(&CloudBackend(&api), command, cli.json).await,
Command::Env(command) => match command {
EnvCommand::List(page) => api.list("/v1/environment-variable-sets", "sets", &page, true, &[]).await?,
EnvCommand::List(page) => api.list("/v1/environment-variable-sets", "sets", &page, &[]).await?,
EnvCommand::Get { id } => api.get(&format!("/v1/environment-variable-sets/{id}")).await?,
EnvCommand::Create(data) => api.post("/v1/environment-variable-sets", &input::object(Some(&data.data))?).await?,
EnvCommand::Update { id, data } => put(&api, &format!("/v1/environment-variable-sets/{id}"), input::object(Some(&data.data))?).await?,
EnvCommand::Delete { id } => delete(&api, &format!("/v1/environment-variable-sets/{id}")).await?,
},
Command::Registry(command) => match command {
RegistryCommand::List(page) => api.list("/v1/registry-credentials", "credentials", &page, true, &[]).await?,
RegistryCommand::List(page) => api.list("/v1/registry-credentials", "credentials", &page, &[]).await?,
RegistryCommand::Create(data) => api.post("/v1/registry-credentials", &input::object(Some(&data.data))?).await?,
RegistryCommand::Update { id, data } => put(&api, &format!("/v1/registry-credentials/{id}"), input::object(Some(&data.data))?).await?,
RegistryCommand::Delete { id } => delete(&api, &format!("/v1/registry-credentials/{id}")).await?,
},
Command::Connections(command) => connections(&api, command).await?,
Command::Models(command) => match command {
ModelCommand::List => api.get("/v1/models").await?,
ModelCommand::Providers => api.get("/v1/model-gateway/providers").await?,
Expand Down Expand Up @@ -332,7 +331,7 @@ async fn filtered_list(
no_match: Option<String>,
json: bool,
) -> Result<u8> {
let result = api.list(path, field, page, true, filters).await?;
let result = api.list(path, field, page, filters).await?;
print_filtered_list(result, field, no_match, json)
}

Expand Down Expand Up @@ -673,7 +672,7 @@ pub(crate) async fn files(api: &Api, command: FileCommand) -> Result<Value> {

pub(crate) async fn volumes(api: &Api, command: VolumeCommand) -> Result<Value> {
match command {
VolumeCommand::List(page) => api.list("/v1/volumes", "volumes", &page, true, &[]).await,
VolumeCommand::List(page) => api.list("/v1/volumes", "volumes", &page, &[]).await,
VolumeCommand::Get { id } => api.get(&format!("/v1/volumes/{id}")).await,
VolumeCommand::Delete { id } => delete(api, &format!("/v1/volumes/{id}")).await,
VolumeCommand::Create {
Expand Down Expand Up @@ -705,10 +704,7 @@ pub(crate) async fn volumes(api: &Api, command: VolumeCommand) -> Result<Value>

pub(crate) async fn endpoints(api: &Api, command: EndpointCommand) -> Result<Value> {
match command {
EndpointCommand::List(page) => {
api.list("/v1/ingresses", "ingresses", &page, true, &[])
.await
}
EndpointCommand::List(page) => api.list("/v1/ingresses", "ingresses", &page, &[]).await,
EndpointCommand::Get { id } => api.get(&format!("/v1/ingresses/{id}")).await,
EndpointCommand::Create {
name,
Expand Down Expand Up @@ -903,31 +899,6 @@ pub(crate) async fn images(api: &Api, command: ImageCommand) -> Result<Value> {
}
}

async fn connections(api: &Api, command: ConnectionCommand) -> Result<Value> {
let root = "/v1/gateway/connections";
match command {
ConnectionCommand::List(page) => api.list(root, "connections", &page, false, &[]).await,
ConnectionCommand::Get { id } => api.get(&format!("{root}/{id}")).await,
ConnectionCommand::Create(data) => api.post(root, &input::object(Some(&data.data))?).await,
ConnectionCommand::Update { id, data } => put(api, &format!("{root}/{id}"), input::object(Some(&data.data))?).await,
ConnectionCommand::Delete { id } => delete(api, &format!("{root}/{id}")).await,
ConnectionCommand::Refresh { id } => api.post(&format!("{root}/{id}/refresh"), &json!({})).await,
ConnectionCommand::Grant { id, data } => put(api, &format!("{root}/{id}/grants"), input::object(Some(&data.data))?).await,
ConnectionCommand::Oauth { id, no_browser } => {
let result = api.post(&format!("{root}/{id}/oauth"), &json!({})).await?;
let url = result["url"].as_str().context("Missing OAuth URL")?;
if !no_browser && let Err(error) = auth::open_browser(url) { eprintln!("{error}. Open the returned URL manually."); }
Ok(result)
},
ConnectionCommand::OauthComplete { id, data } => api.post(&format!("{root}/{id}/oauth/complete"), &input::object(Some(&data.data))?).await,
ConnectionCommand::Calls { id, page } => api.list(&format!("{root}/{id}/calls"), "calls", &page, false, &[]).await,
ConnectionCommand::Principals => api.get("/v1/gateway/principals").await,
ConnectionCommand::Search { query, offset } => api.json(Method::GET, "/v1/gateway/search", None, &[("query".into(),query),("offset".into(),offset.to_string())], None).await,
ConnectionCommand::Describe { connection, tool } => api.post("/v1/gateway/describe", &json!({"connectionId":connection.to_string(),"tool":tool})).await,
ConnectionCommand::Call { connection, tool, arguments } => api.post("/v1/gateway/call", &json!({"connectionId":connection.to_string(),"tool":tool,"arguments":input::object(Some(&arguments))?})).await,
}
}

async fn keys(api: &Api, command: KeyCommand) -> Result<Value> {
match command {
KeyCommand::List { offset } => {
Expand Down
Loading
Loading