Long-running calls
A test run can take longer than an MCP client is willing to wait for one tool call.
A test run can take longer than an MCP client is willing to wait for one tool call. So the remote server stops waiting after 50 seconds and returns the run id. The run keeps going on the server. You then poll for the result with heybug_get_run.
This guide covers the 50 second limit, the status values you will see, and the polling pattern. For setup, see MCP.
What it is for
Use this when an assistant starts a run and needs the result, but the run may take a few minutes:
heybug_runstarts a test run of a URL and waits for it.heybug_planwaits for a test plan to be proposed.heybug_generate_and_runapplies a pending plan and waits for its results.heybug_get_runreads a run and can wait on it, for up to 45 seconds per call.
Each call that waits returns one of two things: the finished result, or the id to poll.
The 50 second limit
The limit applies to the remote server at /api/mcp. A tool call that is still going at 50 seconds returns what is known so far and says that the work continues. It is not an error.
Over local stdio (heybug mcp), heybug_run waits up to 15 minutes. After that it returns with "Still running after 15 minutes; stopped waiting." Poll the same way.
Status values
| Kind | Status | Meaning |
|---|---|---|
| Run | queued, running | Still going. Poll again. |
| Run | passed | Every test passed. |
| Run | failed | At least one test failed. Read the failing step. |
| Run | error | An infrastructure problem, not a test verdict. Start a new run. |
| Run | canceled | Stopped before it finished. The results are incomplete. |
| Quick run | exploring, running | Still going. Poll again. |
| Quick run | done | Finished. Check the pass and fail counts. |
| Quick run | failed | Could not complete. Read the error text. |
Failing cases from heybug_get_run include the failing step, Expected, Actual and a web link to the case.
Polling pattern
- Start the run. Call
heybug_runwithurl. Leavewaitat its default, or send"wait": falseto get the id straight away. - Keep the id. If the reply says "Stopped waiting after 50s" or "Still running", take the id it names. It is the run id.
- Poll. Call
heybug_get_runwithrunIdandwaitset to45. The call returns when the run finishes or after 45 seconds, so it stays under the 50 second limit. - Repeat step 3 while the status is
queuedorrunning. - Stop when the status is
passed,failed,errororcanceled. Read the failures, or start a new run forerror.
Example
Start the run on the remote server:
curl -s https://opentest.nagara.cloud/api/mcp \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"heybug_run","arguments":{"url":"https://staging.crate.so"}}}'After 50 seconds the reply might say (the id here is an example):
Stopped waiting after 50s; the work continues on the server. Call heybug_get_run with id "run_123" to get the result.Poll with that id:
curl -s https://opentest.nagara.cloud/api/mcp \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"heybug_get_run","arguments":{"runId":"run_123","wait":45}}}'While the run is going, the reply ends with "Still running; call heybug_get_run again with wait." When it finishes, the reply names the verdict, the counts, and a link to /p/{project}/runs/{run} in the web app.
To list the latest runs of a project when you lost the id, call heybug_list_runs with projectId.
When it fails
- "Stopped waiting" or "Still running". This is not a failure. Poll with the id.
- "Lost contact while waiting for the run". The connection dropped. The run continues, so poll again with the same id.
- "runId is required". Pass the
runIdfrom the reply.heybug_get_runneeds it. - The id starts with
exp_. That id belongs to an exploration, not a run, soheybug_get_runwill not find it. Open theDetails:link in the reply instead. - Status
error. An infrastructure problem. Start a new run withheybug_run. - 401 or 403. The key or the
Originheader is wrong. See MCP troubleshooting. - A tool is missing. Restart the client and compare with
GET /api/mcp/tools.