Make your coding agent run the API tests before every PR
An AI coding agent changes an endpoint, the unit tests pass, it opens a pull request, and the first person to call the endpoint finds the JSON field renamed. The agent had no way to know: nothing told it there were API tests, or how to run them.
With the Requestarium MCP server connected, the agent can run your collections. A short paragraph in the project's instructions file makes it do so every time.
The instructions
Most agents read a project instructions file on every task: CLAUDE.md for Claude Code, AGENTS.md for many others, .cursor/rules for Cursor. Add a section like this:
## API tests
The HTTP API in `src/api/` is covered by Requestarium collections, available through
the `requestarium` MCP server.
- `src/api/orders/**` → collection "Orders API"
- `src/api/users/**` → collection "Users API"
- `src/api/auth/**` → collection "Users API", folder "Auth"
When you change code under `src/api/`:
1. Start the server locally (`make dev`), then run the matching collection with
`run_collection` and the environment "Local".
2. If a request fails, find out whether the code or the request is wrong. Fix the code
if the old behaviour was right. If the behaviour changed on purpose, say so and
update the request's tests with `update_request`.
3. For a new endpoint or field, add a request (or a test to an existing one) that
checks it, in the right folder.
4. Before you finish, run the collection again. Report the pass count.
Never change environment values or delete requests without asking.The mapping is what makes it work. Without it, the agent has to guess which of your 14 collections matters.
What happens then
Ask for a change as usual: "Rename customerId to customer_id in the order response". The agent edits the code, runs Orders API against Local, sees three requests fail on the missing customerId, and either asks whether the rename was intended or updates the tests, depending on how you phrased the request. You get a summary with the pass count.
Keep it honest
- Run against Local, not Staging. The agent tests the code it just wrote, which only runs on your machine. The local MCP server sends requests from your computer, so
localhostworks. - Make "changed tests" visible. Ask the agent to list every test it changed in its final message. A test that changed to match new behaviour is a decision for a person.
- Keep the mapping current. When you add a collection, add a line.
In CI, too
The agent's local run is a first check. The pull request still runs the same collection in CI, with the CLI, so a change that skipped the instructions is caught there.