# queue_withdraw

> Release: 0.13.0 · Last changed: 2026-11-18 · Source: https://github.com/KeiaiLab/SwarmOps/blob/stable/docs/reference/mcp-tools/queue-withdraw.md

Takes an open entry out of its landing queue (reason withdrawn); it is never published. One that landed is E\_INVALID\_ARG (already\_landed).

```yaml
title: "queue_withdraw"
description: "Withdraw a queued change."
since: "0.13.0"
mutates: true
identity_required: true
cli_command: "swarmops queue withdraw"
envelope_op: "queue_withdraw"
request_type: "QueueWithdrawReq"
annotations: {"destructiveHint":true,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":false}
max_result_chars: null
```

## Input schema

`arguments` is a `QueueWithdrawReq`: `swarmops schema QueueWithdrawReq` prints the type. A field the type does not know is ignored.

| Field | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `entry` | string | yes |  | The entry's id. |

### JSON Schema

As `tools/list` gives it: each `$ref` replaced by its definition, so that it stands alone.

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "description": "`queue_withdraw`: take an open entry out of its queue (reason `withdrawn`). One that landed\nis `E_INVALID_ARG` (`details.reason` `already_landed`), and nothing is written. The answer\nis the entry.",
  "properties": {
    "entry": {
      "description": "The entry's id.",
      "type": "string"
    }
  },
  "required": [
    "entry"
  ],
  "title": "QueueWithdrawReq",
  "type": "object"
}
```

## Annotations

It moves or deletes refs by compare-and-swap, changing what they name. Run again with the same arguments, it finds them as it asked (`already_applied`) or not as it expected (`E_CAS_MISMATCH`), and changes nothing more.

| Annotation | Value | Meaning |
| --- | --- | --- |
| `destructiveHint` | `true` | True: a tool that changes the store may overwrite or delete what is there, not only add to it. |
| `idempotentHint` | `true` | True: calling it again with the same arguments changes nothing more. |
| `openWorldHint` | `false` | True: it reaches beyond a closed set of things. Every tool here stays inside the store. |
| `readOnlyHint` | `false` | True: the tool does not change its environment, the store. |

Its entry in `tools/list` carries no `_meta`.

## CLI command

[`swarmops queue withdraw`](../commands/queue-withdraw.md) runs the same operation and prints the same envelope.

## Examples

### MCP

```json
{
  "id": 4,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "entry": "[entry2]"
    },
    "name": "queue_withdraw"
  }
}
```

```json
{
  "id": 4,
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "text": "{\"api\":1,\"meta\":{\"auth\":\"trust\",\"elapsed_ms\":\"[elapsed_ms]\",\"repo\":\"[tmp]/store\",\"resolved\":{}},\"ok\":true,\"op\":\"queue_withdraw\",\"result\":{\"base\":\"[main]\",\"head\":\"[second]\",\"id\":\"[entry2]\",\"removal\":\"withdrawn\",\"state\":\"removed\",\"target\":\"main\"}}",
        "type": "text"
      }
    ],
    "isError": false,
    "structuredContent": {
      "api": 1,
      "meta": {
        "auth": "trust",
        "elapsed_ms": "[elapsed_ms]",
        "repo": "[tmp]/store",
        "resolved": {}
      },
      "ok": true,
      "op": "queue_withdraw",
      "result": {
        "base": "[main]",
        "head": "[second]",
        "id": "[entry2]",
        "removal": "withdrawn",
        "state": "removed",
        "target": "main"
      }
    }
  }
}
```

The server ran as `swarmops mcp --repo [tmp]/store --as agent/worker-17`, after `initialize`. Recorded by the MCP tests. A name in square brackets, such as `[tmp]` or `[c1]`, stands for what differs from run to run: the test's temporary directory, an id, a time, the version.

## Return information

A tool result: the envelope, whose `op` is `queue_withdraw`, as `structuredContent` and again as the text of its one `content` block. `isError` is true exactly when the envelope's `ok` is false. On success the envelope's `result` is what [`swarmops queue withdraw`](../commands/queue-withdraw.md#return-information) returns.

## Errors

A failed call is a tool result with `isError: true`; the envelope's `error.code` is one of the [error codes](../errors.md).

- [`E_INVALID_ARG`](../errors.md#e_invalid_arg): arguments that do not fit `QueueWithdrawReq`, a field named twice among them included, or that break one of the server's own rules.
- [`E_IDENTITY_REQUIRED`](../errors.md#e_identity_required): the server runs with no identity.
- [`E_NOT_A_REPO`](../errors.md#e_not_a_repo): the server's store is not there; the server serves on.
- [`E_INTERNAL`](../errors.md#e_internal): the operation panicked, a bug.

Then the errors of the operation, as [`swarmops queue withdraw`](../commands/queue-withdraw.md#errors) lists them.

## See also

- [`swarmops queue withdraw`](../commands/queue-withdraw.md)
- [MCP tools](README.md)
- [MCP integration](../../develop/mcp.md)
- [Error codes](../errors.md)
