Let an AI agent investigate failing API tests from CI

The API tests failed in CI. The usual next ten minutes: open the job, scroll the log, find the failing request, open the app, rerun it, check git log for what changed. An AI agent connected to the Requestarium MCP server, with your repository open, can do that loop and hand you a short answer.

What it needs

  • Saved runs. CI runs the collection with --save-run, so each run is stored with its branch, commit and CI link. See API test run history.
  • Your repository open in the agent, so it can read git log and the code.
  • Your API running locally, so it can reproduce the failure. The local MCP server sends requests from your machine.

The prompt

The "Orders API" collection is failing in CI on main. 1. Use list_runs to find the last passing run and the first failing one, with their commits. 2. Run the collection against Local with run_collection to see which requests fail now. 3. For each failing request, look at the response and test results, then git log between the two commits for changes in src/api/orders/. 4. Tell me which commit most likely broke each request, and why. Don't change code or requests yet.

What you get back

Something like:

Last green: main@d187326 (Nov 24, 18:22). First red: main@a91f0c2 (Nov 25, 09:10). Failing locally: Orders/Get order (total is now a string, test expects a number) and Orders/List orders (same field). Between the two commits, a91f0c2 changed src/api/orders/serialize.ts to format total with toFixed(2), which returns a string. Either serialize it as a number again, or update the tests and tell API consumers about the change.

Then you decide which fix, and can ask the agent to make it.

Flaky or broken?

Ask the agent to look at a longer stretch of runs: "In the last 20 runs, does Get order fail every time since a commit, or on and off?". A request that fails on and off across branches is likely flaky, not broken by a commit. See how to deal with flaky API tests.

Limits

  • list_runs gives each run's pass and fail counts, branch, commit and CI link. The agent reruns requests to see the details, so it needs the API running.
  • If the failure only happens in CI (a missing secret, a network rule), a local rerun passes. Then the CI log is the place to look, and the agent should say so instead of guessing.