SwarmOps
ReferenceMcp toolspath_history
View as Markdown

path_history#

The changesets that changed a file, or anything below a directory, newest first along first parents from main unless rev says otherwise, each with what the path holds after it (the CLI command is history); pass a limit of 100 or less and page on with the cursor, since clients limit long tool results.

Metadata
Since
0.1.0
Mutates
no
Identity required
no
Envelope op
path_history
Cli command
swarmops history
Request type
PathHistoryReq
Annotations
{"destructiveHint":false,"idempotentHint":true,"openWorldHint":false,"readOnlyHint":true}
Max result chars
null
CLI command
swarmops history

Input schema#

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

FieldTypeRequiredDefaultDescription
cursorstring or nullnoResume a history: the previous page's cursor. Pass it back exactly as returned; do not construct it (cursors are opaque). This page continues from the first parent of the changeset it names, and rev is not used.
limitintegerno50The most entries to return: at least 1 (0 is E_INVALID_ARG).
pathstringyesThe repository path: a file, whose history is that of its content and kind, or a directory, whose history is that of everything below it. One trailing / is taken.
revstring or nullnoWhere to start; main when omitted.

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": "`path_history` (CLI `history`): the changesets that changed what a path holds, newest first,\nfollowing first parents, a page at a time.",
  "properties": {
    "cursor": {
      "description": "Resume a history: the previous page's `cursor`. Pass it back exactly as returned; do not\nconstruct it (cursors are opaque). This page continues from the first parent of the\nchangeset it names, and `rev` is not used.",
      "type": [
        "string",
        "null"
      ]
    },
    "limit": {
      "default": 50,
      "description": "The most entries to return: at least 1 (0 is `E_INVALID_ARG`).",
      "format": "uint",
      "minimum": 1,
      "type": "integer"
    },
    "path": {
      "description": "The repository path: a file, whose history is that of its content and kind, or a\ndirectory, whose history is that of everything below it. One trailing `/` is taken.",
      "type": "string"
    },
    "rev": {
      "anyOf": [
        {
          "description": "A revision as the caller wrote it, for the store to resolve: a ref name (`main`,\n`release/1.2`), a full 64-hex changeset id or a unique prefix of at least 12 hex digits,\noptionally followed by `~N` for the N-th first-parent ancestor.",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Where to start; `main` when omitted."
    }
  },
  "required": [
    "path"
  ],
  "title": "PathHistoryReq",
  "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 history runs the same operation and prints the same envelope.

Examples#

{
  "id": 15,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "src/lib.rs"
    },
    "name": "path_history"
  }
}
{
  "id": 15,
  "jsonrpc": "2.0",
  "result": {
    "content": [
      {
        "text": "{\"ok\":true,\"op\":\"path_history\",\"api\":1,\"result\":{\"path\":\"src/lib.rs\",\"entries\":[{\"changeset\":\"[landed]\",\"op\":\"put\",\"kind\":\"file\",\"id\":\"[id6]\",\"author_agent\":\"agent/worker-17\",\"created_at\":\"[created_at]\",\"title\":\"change f\"},{\"changeset\":\"[c1]\",\"op\":\"put\",\"kind\":\"file\",\"id\":\"[id7]\",\"author_agent\":\"agent/worker-17\",\"created_at\":\"[created_at]\",\"title\":\"first\"}],\"truncated\":false},\"meta\":{\"repo\":\"[tmp]/store\",\"elapsed_ms\":\"[elapsed_ms]\",\"resolved\":{\"main\":\"[landed]\"},\"auth\":\"trust\"}}",
        "type": "text"
      }
    ],
    "isError": false,
    "structuredContent": {
      "api": 1,
      "meta": {
        "auth": "trust",
        "elapsed_ms": "[elapsed_ms]",
        "repo": "[tmp]/store",
        "resolved": {
          "main": "[landed]"
        }
      },
      "ok": true,
      "op": "path_history",
      "result": {
        "entries": [
          {
            "author_agent": "agent/worker-17",
            "changeset": "[landed]",
            "created_at": "[created_at]",
            "id": "[id6]",
            "kind": "file",
            "op": "put",
            "title": "change f"
          },
          {
            "author_agent": "agent/worker-17",
            "changeset": "[c1]",
            "created_at": "[created_at]",
            "id": "[id7]",
            "kind": "file",
            "op": "put",
            "title": "first"
          }
        ],
        "path": "src/lib.rs",
        "truncated": false
      }
    }
  }
}

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#

It lists the changesets that changed a file, or anything below a directory, newest first along first parents from main unless rev says otherwise, each with what the path holds after it. Pass a limit of 100 or less and page on with the cursor. Its CLI command is history.

Return information#

A tool result: the envelope, whose op is path_history, 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 history 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 PathHistoryReq, 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 history lists them.

See also#

Edit on GitHub

On this page