Skip to main content
Glama
Dynamics 365 MCP Server

Dynamics 365 MCP Server

by Kenny-666

query_by_fetchxml

Executes FetchXML queries against Dynamics 365/Dataverse with state policy and paging controls, returning one page by default plus continuation data for resuming larger results.

Instructions

Execute FetchXML with explicit state policy and bounded native cookie/simple paging. Defaults to one page. Returns value, effective query, completeness and continuation; use fetch_all for multiple pages.

Input Schema

NameRequiredDescriptionDefault
fetch_allNoFollow server paging up to max_records/max_pages. Default false returns one page.
fetch_xmlNoThe FetchXML string to execute
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.
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, the description carries the full behavioral burden. It discloses paging behavior, the single-page default, state policy options, and return fields (value, effective query, completeness, continuation), which is useful. It does not mention read-only/side-effect status, permission requirements, or the five-minute continuation validity, though the schema covers continuation validity.

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 compact and front-loads the core behavior. The phrase 'use fetch_all for multiple pages' is slightly ambiguous because fetch_all is a parameter, not a separate tool, but the sentence still earns its place by routing the caller to the multi-page option.

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?

This is a complex ten-parameter query tool with no annotations and no output schema, though the description does summarize the return fields. It omits guidance on when to use this versus sibling query tools and does not describe permission or safety characteristics. The 100% schema coverage compensates for much of the parameter detail.

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%, so the schema already documents all ten parameters thoroughly, including state_mode, state_values, page_size, max_records, and continuation. The description adds only high-level framing for state policy and bounded paging; it does not add parameter-level meaning beyond the schema.

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 clearly states a specific verb and resource: 'Execute FetchXML'. It also names its main behaviors (state policy, bounded paging, single-page default) and return shape. However, it does not distinguish this tool from the many sibling query tools such as preview_fetchxml_query or search_records_by_odata.

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?

The description indicates a default of one page and says to 'use fetch_all for multiple pages', which is useful paging guidance. It does not explain when to choose this tool over preview_fetchxml_query, search_records_by_odata, or other query siblings, leaving that choice implicit.

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