Skip to main content
Glama
Dataverse Mcp Server

Dataverse Mcp Server

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

NameRequiredDescriptionDefault
topNoMaximum 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.
cursorNoThe 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.
expandNoRelated entities to expand ($expand)
filterNoOData filter expression ($filter)
selectNoComma-separated list of columns to return ($select)
orderbyNoOrder by expression ($orderby)
page_sizeNoRecords per page (Prefer: odata.maxpagesize); the rest come through cursor. Not with top. Whole number from 1 to 5000.
entity_setYesEntity set name (plural, e.g. 'accounts', 'contacts')

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.11.0
    • addedInput schema / properties / cursor
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
    • addedInput schema / properties / page_size
      Added value: +{
      +  "description": "Records per page (Prefer: odata.maxpagesize); the rest come through cursor. Not with top. Whole number from 1 to 5000.",
      +  "maximum": 5000,
      +  "minimum": 1,
      +  "type": "integer"
      +}
    • changedInput schema / properties / top / description
      Previous value: -"Maximum number of records to return ($top)"New value: +"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."
    • addedInput schema / properties / top / maximum
      Added value: +5000
    • addedInput schema / properties / top / minimum
      Added value: +1
    • changedInput schema / properties / top / type
      Previous value: -"number"New value: +"integer"
  2. Changed1 schema field changedv0.9.0
    • changedInput schema / $schema
      Previous value: -"http://json-schema.org/draft-07/schema#"New value: +"https://json-schema.org/draft/2020-12/schema"
  3. First observedv0.5.0

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full behavioral burden and does so thoroughly: default page size of 5000, cursor continuation semantics, non-continuable top with more possibly 'unknown', expand paging limits, nested expand restrictions, and the shape of the returned object.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and every sentence carries useful information for a complex 8-parameter tool, so its length is largely justified. It is dense and could be easier to scan if broken into shorter structured sections, but there is little obvious filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity, eight parameters, lack of annotations, and lack of an output schema, the description is highly complete. It covers return shape, pagination, cursor behavior, top limitations, expand behavior, error cases, and alternatives to sibling tools.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Although schema description coverage is 100%, the description adds meaningful parameter interactions beyond the schema: cursor must be used with the same entity_set and no other query parameters, top cannot be combined with page_size, orderby should end with a unique column for stable paging, and expand nesting restricts which options are allowed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description starts with a specific verb and resource: read records from a table/entity set, with OData query options and a defined return shape. It distinguishes this from siblings by explicitly naming aggregate_records for counting/summing/grouping and get_record for reading a single record by id.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit when-to-use guidance: page_size versus top, how to continue via cursor when more is true, when to use aggregate_records, when to use get_record, and when to use Microsoft.Dynamics.CRM.In for long id lists. It also identifies error conditions such as unknown entity sets, bad OData expressions, bad cursors, and excessive filter conditions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.