SwarmOps
ReferenceMcp toolsqueue_wait

Page kind: Reference

queue_wait#

Describes v0.13.0Last changed View as Markdown

Waits for an entry to land and answers it; a removed entry is its removal's error (details.reason), and one still open after timeout_s is E_QUEUE_WAIT_TIMEOUT, retryable: pass a timeout_s of 600 or less and call again.

Metadata
Since
0.13.0
Mutates
no
Identity required
no
Envelope op
queue_wait
Cli command
swarmops queue wait
Request type
QueueWaitReq
Annotations
{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true}
Max result chars
null

Input schema#

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

FieldTypeRequiredDefaultDescription
entrystringyesThe entry's id.
timeout_sinteger or nullnoThe most seconds to wait; without limit when omitted.

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_wait`: wait for an entry to land. The answer is the landed entry; a removed one is\nan error naming its removal, and one still open at the timeout is `E_QUEUE_WAIT_TIMEOUT`.",
  "properties": {
    "entry": {
      "description": "The entry's id.",
      "type": "string"
    },
    "timeout_s": {
      "description": "The most seconds to wait; without limit when omitted.",
      "format": "uint64",
      "minimum": 0,
      "type": [
        "integer",
        "null"
      ]
    }
  },
  "required": [
    "entry"
  ],
  "title": "QueueWaitReq",
  "type": "object"
}

Annotations#

It only reads the store.

AnnotationValueMeaning
destructiveHintfalseTrue: a tool that changes the store may overwrite or delete what is there, not only add to it.
idempotentHinttrueTrue: calling it again with the same arguments changes nothing more.
openWorldHintfalseTrue: it reaches beyond a closed set of things. Every tool here stays inside the store.
readOnlyHinttrueTrue: the tool does not change its environment, the store.

Its entry in tools/list carries no _meta.

CLI command#

swarmops queue wait runs the same operation and prints the same envelope.

Examples#

JSON
{
  "id": 5,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "entry": "[entry1]",
      "timeout_s": 60
    },
    "name": "queue_wait"
  }
}
JSON
{
  "id": 5,
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "text": "{\"api\":1,\"meta\":{\"auth\":\"trust\",\"elapsed_ms\":\"[elapsed_ms]\",\"repo\":\"[tmp]/store\",\"resolved\":{}},\"ok\":true,\"op\":\"queue_wait\",\"result\":{\"base\":\"[main]\",\"candidate\":\"[landed]\",\"check\":\"sh -c if [ -e slow ]; then sleep 3; fi; if [ -e bad ]; then exit 1; fi; exit 0\",\"head\":\"[first]\",\"id\":\"[entry1]\",\"key\":\"k-1\",\"landed\":\"[landed]\",\"state\":\"landed\",\"target\":\"main\",\"tree\":\"[id1]\",\"verdict\":\"passed\"}}",
        "type": "text"
      }
    ],
    "isError": false,
    "structuredContent": {
      "api": 1,
      "meta": {
        "auth": "trust",
        "elapsed_ms": "[elapsed_ms]",
        "repo": "[tmp]/store",
        "resolved": {}
      },
      "ok": true,
      "op": "queue_wait",
      "result": {
        "base": "[main]",
        "candidate": "[landed]",
        "check": "sh -c if [ -e slow ]; then sleep 3; fi; if [ -e bad ]; then exit 1; fi; exit 0",
        "head": "[first]",
        "id": "[entry1]",
        "key": "k-1",
        "landed": "[landed]",
        "state": "landed",
        "target": "main",
        "tree": "[id1]",
        "verdict": "passed"
      }
    }
  }
}

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_wait, 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 wait returns.

Errors#

A failed call is a tool result with isError: true; the envelope's error.code is one of the error codes.

  • E_INVALID_ARG: arguments that do not fit QueueWaitReq, a field named twice among them included, or that break one of the server's own rules.
  • E_NOT_A_REPO: the server's store is not there; the server serves on.
  • E_INTERNAL: the operation panicked, a bug.

Then the errors of the operation, as swarmops queue wait lists them.

See also#

On this page