Browse documentation

put_view

[Saved Views]

Create or replace a saved exact query conditionally. Retain requestId after an ambiguous response.

Parameters

NameTypeRequiredDescription
collectionIdstringYesCollection ID from list_collections.
definitionjsonYesThe saved query: title and query (required), with an optional description and status. query takes the filter, orderBy, and fields that list_documents accepts. An optional relativeDate keeps a moving window: path (a /data date), period (day, week, or month), timeZone (IANA), and offset (default 0).
ifRevisionstringYesUse "absent" to create, or the current revision to replace. A stale revision returns revision_conflict.
keystringYesStable view key, unique in its collection.
requestIdstringYesA fresh UUID for each change. After an ambiguous response, retry with the same requestId and identical arguments; a changed payload returns request_conflict.
spaceIdstringYesWorkspace ID from list_spaces.

Examples

Replace the sample IDs with values from your store. Use a fresh UUID for each requestId.

Save a query for decisions updated this week.

Arguments
{
  "spaceId": "11111111-1111-4111-8111-111111111111",
  "collectionId": "33333333-3333-4333-8333-333333333333",
  "key": "this-week",
  "definition": {
    "title": "Updated this week",
    "query": {
      "orderBy": [
        {
          "path": "/updatedAt",
          "type": "instant",
          "direction": "desc"
        }
      ]
    },
    "relativeDate": {
      "path": "/data/decidedOn",
      "period": "week",
      "timeZone": "Europe/Madrid"
    }
  },
  "ifRevision": "absent",
  "requestId": "77777777-7777-4777-8777-777777777777"
}
Full MCP request
Full MCP request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "put_view",
    "arguments": {
      "spaceId": "11111111-1111-4111-8111-111111111111",
      "collectionId": "33333333-3333-4333-8333-333333333333",
      "key": "this-week",
      "definition": {
        "title": "Updated this week",
        "query": {
          "orderBy": [
            {
              "path": "/updatedAt",
              "type": "instant",
              "direction": "desc"
            }
          ]
        },
        "relativeDate": {
          "path": "/data/decidedOn",
          "period": "week",
          "timeZone": "Europe/Madrid"
        }
      },
      "ifRevision": "absent",
      "requestId": "77777777-7777-4777-8777-777777777777"
    }
  }
}