ref_list#
Every ref, the changeset it points at, and how many moves it has had.
- Since
0.1.0- Mutates
- no
- Identity required
- no
- Envelope op
ref_list- Cli command
swarmops ref list- Request type
RefListReq- Annotations
{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true}- Max result chars
null- CLI command
swarmops ref list
Input schema#
arguments is a RefListReq: swarmops schema RefListReq prints the type. A field the type does not know is ignored.
It takes no fields: pass {}.
JSON Schema#
As tools/list gives it: each $ref replaced by its definition, so that it stands alone.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "`ref list`: list every ref. It has no options yet.",
"title": "RefListReq",
"type": "object"
}Annotations#
It only reads the store.
| Annotation | Value | Meaning |
|---|---|---|
destructiveHint | false | 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 | true | True: the tool does not change its environment, the store. |
Its entry in tools/list carries no _meta.
CLI command#
swarmops ref list runs the same operation and prints the same envelope.
Examples#
{
"id": 21,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "ref_list"
}
}{
"id": 21,
"jsonrpc": "2.0",
"result": {
"content": [
{
"text": "{\"ok\":true,\"op\":\"ref_list\",\"api\":1,\"result\":{\"refs\":[{\"name\":\"main\",\"target\":\"[landed]\",\"version\":3},{\"name\":\"release/v1\",\"target\":\"[c1]\",\"version\":1}]},\"meta\":{\"repo\":\"[tmp]/store\",\"elapsed_ms\":\"[elapsed_ms]\",\"resolved\":{},\"auth\":\"trust\"}}",
"type": "text"
}
],
"isError": false,
"structuredContent": {
"api": 1,
"meta": {
"auth": "trust",
"elapsed_ms": "[elapsed_ms]",
"repo": "[tmp]/store",
"resolved": {}
},
"ok": true,
"op": "ref_list",
"result": {
"refs": [
{
"name": "main",
"target": "[landed]",
"version": 3
},
{
"name": "release/v1",
"target": "[c1]",
"version": 1
}
]
}
}
}
}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.
Details#
Every ref, the changeset it points at and how many moves it has had.
A ref's target is the full id to pass as expected_old to ref_set or ref_delete, or as
parent to a commit with advance.
Return information#
A tool result: the envelope, whose op is ref_list, 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 ref list 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
RefListReq, 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 ref list lists them.
See also#
ref_delete
Removes a ref by compare-and-swap, if it still holds expected\_old, the full 64-hex changeset id it held when you read it; a ref name or a relative revision…
ref_set
Moves a ref, or creates one, by compare-and-swap: give create, or expected\_old, the full 64-hex changeset id the ref held when you read it; a ref name or a…