# Requests for AI

> How your AI reads, edits and runs an API doc's saved requests: MCP, the desktop app's AI panel, and the CLI.

Your AI works with an API doc's requests through the same tools as the spec: no extra setup.

## Reading

Through MCP `get` on an API doc:

| Read | Gives |
|---|---|
| (none) | The overview, with the requests as an outline: one short line each (`r7 POST {{baseUrl}}/bookings · Create booking`) |
| `requests: ["r7", "Bookings/Create booking"]` | Requests in full; `true` for all |
| `scripts: "r7"` | The request's [scripts](/help/api-docs/scripts) in full, every level's, in the order they run |
| `envs: true` | Environments and their shared values; secrets by name only. With View or Comment access, names only and keys masked |
| `call: {"request": "r7", "env": "Staging"}` | The request as curl, secrets as environment variables |

## Editing

`edit_openapi` with `collection` ops changes the requests: add a request, folder or environment (`from_op: "POST /bookings"` fills a request from the spec), set fields (a script with `pre` or `test`), rename, move, delete, or update a request from its operation. All ops in a call land as one change, named in History. Secrets are named, never given values.

## Running in the desktop app

In the **Dockito desktop app**, the AI panel's AI can run the doc's saved requests itself and read the results, with two tools the app adds for it:

- `run_requests`: one request, a folder, or all of them (at most 50 a call), with an environment by name or the one picked. They're sent from your computer, with your values and secrets, and the run is kept in **Past runs on this computer**. Only saved requests run: to try something new, your AI edits a request first.
- `last_run`: the latest run or response of the doc on your computer.

Before the first run in a chat, the panel shows what will run (how many, the methods, the environment and the hosts) and asks: **Run once**, **Allow in this chat** or **Don't**. A POST, PUT, PATCH or DELETE to a host other than your computer always asks first, listed one by one. The results reach your AI in a few lines, secrets hidden. The doc's requests must be open in the window.

**Add to chat**, beside **Copy for AI** on a response or a run, attaches it to the AI panel the same way.

## Running from a terminal

Your AI runs a request itself, as the curl `call` gives, or with the CLI:

```sh
dockito run <doc> "Create booking" --env Staging
dockito env set <doc> Staging bookingsToken     # kept in this machine's keychain
dockito pull <doc> --as postman
```

`dockito run` checks the response against the spec when the request is linked to an operation. Requests are sent from your machine, never from Dockito.
