query_records
Read Dataverse table records with OData select, filter, orderby and expand, returning a page and cursor for continuation; use top only for capped results and aggregate separately.
Instructions
Read records from a table (entity set) with optional OData select, filter, orderby and expand, and either page_size or top; returns a JSON object {records, more, cursor}. Records come one page at a time, page_size rows or 5000 when neither page_size nor top is given: while more is true, call query_records again with the same entity_set and only the returned cursor to get the next page; the last page has more false and no cursor. For stable pages, end orderby with a unique column such as the table's id. top caps the whole result and cannot be continued: when exactly top records come back more is "unknown", so do not count or sum over such a result; to count, sum or group records, use aggregate_records, which Dataverse computes without reading them. With one level of expand, an expanded collection is not paged and brings up to 5000 related rows per record; bound it with $top inside expand. With an expand nested in another, only $select and $filter are allowed inside expand, and without top every expanded collection is cut to the page size; its rest cannot be read through cursor. An unknown entity set, a bad OData expression, a bad cursor or a filter with too many conditions across relationships is an error; for a long list of ids use Microsoft.Dynamics.CRM.In(...) instead of an or chain. To read one record by its id, use get_record.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"entity_set": "<entity_set>"
},
"name": "query_records"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | Maximum number of records of the whole result ($top), with no continuation: when exactly top records come back, more is "unknown". Not with page_size. Whole number from 1 to 5000. | |
| cursor | No | The cursor a previous call returned, to read the next page of that query. Pass it with the same entity_set and none of select, filter, orderby, expand, top or page_size: the query is in the cursor. | |
| expand | No | Related entities to expand ($expand) | |
| filter | No | OData filter expression ($filter) | |
| select | No | Comma-separated list of columns to return ($select) | |
| orderby | No | Order by expression ($orderby) | |
| page_size | No | Records per page (Prefer: odata.maxpagesize); the rest come through cursor. Not with top. Whole number from 1 to 5000. | |
| entity_set | Yes | Entity set name (plural, e.g. 'accounts', 'contacts') |