Tools

query_pages

Filter, sort, group, and paginate pages within a collection. Returns excerpts.

Last updated

query_pages

Query pages in a collection with structured filters, sorts, grouping, and pagination. Mirrors the view engine the human UI uses.

Query responses return 300-character excerpts, not full bodies — follow up with read_page for any page the agent needs in full.

Arguments

NameTypeRequiredDescription
collection_idstringyesThe ID of the collection to query.
filtersobjectnoA FilterGroup { combinator: "and"|"or", rules: [...] }. Forwarded verbatim to the query engine.
sortsobject[]noSort rules: [{ propertyId, direction }].
group_bystringnopropertyId to group results by.
limitnumbernoMax rows to return. Positive integer, capped at 500. Default 50.
cursorstringnoPagination cursor from a previous response.

The filters and sorts shapes are defined by the Plainwork query engine; the MCP server forwards them as-is and surfaces any engine error. A minimal filter example:

{
  "combinator": "and",
  "rules": [{ "propertyId": "prop_status", "op": "equals", "value": "open" }]
}

Returns

{
  "totalCount": 142,
  "nextCursor": "eyJvZmZzZXQiOjUwfQ==",
  "notes": [
    {
      "id": "note_xyz789",
      "title": "…",
      "excerpt": "First 300 characters of the body…",
      "collectionId": "col_a1b2c3",
      "folderId": null,
      "tags": ["…"],
      "updatedAt": "2026-04-10T09:15:00Z",
      "propertyValues": { "prop_status": "open" }
    }
  ]
}

nextCursor is present when more pages exist. Pass it back as cursor on the next call. When absent, the result set is exhausted.

Example

{
  "tool": "query_pages",
  "arguments": {
    "collection_id": "col_a1b2c3",
    "filters": {
      "combinator": "and",
      "rules": [{ "propertyId": "prop_status", "op": "equals", "value": "open" }]
    },
    "sorts": [{ "propertyId": "prop_updated_at", "direction": "desc" }],
    "limit": 20
  }
}

See also