Skip to main content
Glama
Dynamics 365 MCP Server

Dynamics 365 MCP Server

by Kenny-666

search_records_by_odata

Query Dynamics 365 records via OData with explicit state filtering, stable ordering, and bounded server-driven paging. Returns completeness and continuation for resuming large result sets.

Instructions

Query records using OData with explicit state policy, stable ordering and bounded server-driven paging. Defaults to one page and legacy statecode=0 where valid; all adds no implicit state filter. Returns completeness and continuation.

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": {
      "collection_name": "<collection_name>"
    },
    "name": "search_records_by_odata"
  }
}

Input Schema

NameRequiredDescriptionDefault
topNoNative query limit, independent of per-call max_records. Cannot be combined with page_size.
expandNoOData navigation expansion. Nested child collections are not independently auto-paged.
filterNoOData filter expression
selectNoComma-separated list of attributes to retrieve
orderbyNoComma-separated property paths with optional asc/desc. Primary key is appended as a tie-breaker where available.
fetch_allNoFollow server paging up to max_records/max_pages. Default false returns one page.
max_pagesNoMaximum server pages read per call, default 10, when fetch_all=true.
page_sizeNoRequested server page size, default 500. Cannot be combined with top. FetchXML count is preserved unless the same value is supplied.
state_modeNolegacy preserves valid implicit statecode=0 filtering; all adds no state filter; values uses state_values validated against this table.
max_recordsNoMaximum records returned in this call, default 5000. Remaining records can be resumed with continuation.
continuationNoOpaque cursor from a previous result; valid for five minutes in this server connection. Resumes saved query and buffered records.
state_valuesNoExplicit numeric state values; requires state_mode=values.
collection_nameYesEntitySetName (Web API collection name), e.g. accounts; use table metadata rather than guessing a plural name.
formatted_valuesNoInclude formatted labels and display values returned by CRM.
environment_profileNoOptional named environment profile for this call; omit to use the configured default.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.1.2
    • addedInput schema / properties / environment_profile
      Added value: +{
      +  "description": "Optional named environment profile for this call; omit to use the configured default.",
      +  "pattern": "^[A-Za-z][A-Za-z0-9_]{0,31}$",
      +  "type": "string"
      +}
  2. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

With no annotations provided, the description must carry the full behavioral burden, and it does disclose two important defaults: one page returned by default and legacy statecode=0 filtering where valid. However, most of that detail is also present in the parameter schema, and the description says nothing about read-only semantics, result limits, or what 'completeness' actually means beyond naming it.

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?

Three compact sentences, front-loaded with the core action and followed by defaults and return behavior. No filler, though the second sentence is dense enough that it reads as schema paraphrase rather than added clarity.

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

Completeness3/5

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

For a 15-parameter query tool with no annotations and no output schema, the description does mention that completeness and continuation are returned, which is useful since no output schema exists. Still, it omits read-only status, result size expectations, and when not to use it, so it is adequate rather than complete.

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

Parameters3/5

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

Schema description coverage is 100% and the parameter docs are already detailed, including the top/page_size conflict, continuation lifetime, and state_mode enum meanings. The description adds essentially no parameter-level meaning beyond that, so the baseline 3 applies.

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

Purpose4/5

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

The description opens with a specific verb and resource ('Query records using OData'), and the qualifiers (state policy, stable ordering, bounded paging) distinguish it from a plain record getter. It stops short of naming the OData alternative to a sibling like query_by_fetchxml, leaving a little inference to the agent.

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

Usage Guidelines3/5

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

Usage is only implied: 'OData' suggests this is the OData path rather than FetchXML, and the description explains default paging and state behavior. There is no explicit statement of when to prefer this over query_by_fetchxml, preview_fetchxml_query, or get_record_by_id, and no exclusions are given.

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

Deploy Server

Other Tools