# Query an Embedded MCP result set

Search, filter, page, or aggregate a stored Embedded MCP action result without another provider call.

`query-result-set` reads a result that `execute-actions` stored after a large response. It does not call the app again. Get `resultSetId` from `meta.compaction.resultSet`.

```json
{
  "resultSetId": "<result-set-id>",
  "q": "Acme",
  "fields": [
    "id",
    "name"
  ],
  "limit": 25
}
```

```json
{
  "success": true,
  "data": [
    {
      "id": "row_1",
      "name": "Acme"
    }
  ],
  "meta": {
    "matched": 1,
    "nextCursor": null
  }
}
```

`q` searches across rows. `filters` matches full values by dot-path; string comparisons ignore case. `fields` selects dot-paths, and `sortBy` orders rows. `limit` is 1 to 200, with 25 as the default. Pass `meta.nextCursor` as `cursor` for the next page.

Use `aggregate` for counts or metrics without downloading every row:

```json
{
  "resultSetId": "<result-set-id>",
  "aggregate": {
    "groupBy": [
      "status"
    ],
    "metrics": [
      {
        "op": "count",
        "as": "records"
      }
    ]
  }
}
```

Metrics support `count`, `sum`, `avg`, `min`, and `max`. Each query renews the 30-minute result lifetime. A result belongs to one end user. If it expires, run the original action again.

`count` needs no `field`. Other metric operations need the field to measure. When `aggregate` is set, `fields` is ignored.