# stop_run

URL: https://codepanel.ai/docs/mcp-server/stop_run

The CodePanel MCP tool that stops an agent app run and keeps its task, so it can run again.

`stop_run` stops a run that has not ended. It ends as `stopped`, its waiting interrupts are denied, and the runner stops it at its next step. The task stays, so it can run again. It needs the `tasks:write` scope.

## When to call it

- **To stop work going the wrong way** without dropping the task. To drop the task too, use [`cancel_task`](/docs/mcp-server/cancel_task).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `runId` | string | yes | Id of a run, from get_task's runs or start_task's task |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

`runId`. An ended run is refused with `reason: run_ended`.

## What it returns

`{ before, after }`, each the run.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /tasks/runs/stop` with the `tasks:write` scope |
| CLI | `codepanel run stop <runId>` |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to halt an attempt going the wrong way. Stops a run that has not ended; it ends as stopped, its waiting interrupts are denied, and the runner stops it at its next step (at once on this machine's runner). The task stays, so it can run again; to drop the task too, use cancel_task. An ended run is refused (reason run_ended). Needs tasks:write. Returns { before, after }.

## Related

- [`cancel_task`](/docs/mcp-server/cancel_task): stop the task and its run.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
