Skip to content

mcp_execute_fetchxml

PhuocLe edited this page Jun 18, 2026 · 3 revisions

execute_fetchxml

Summary

Field Value
Tool name execute_fetchxml
MCP title Run a FetchXML query
Category basic
Implementation DynamicsCrm.DevKit.Cli/Mcp/Tools/ExecuteFetchXmlTool.cs
Estimated token count ~208 tokens (tools/list tool JSON, o200k_base, measured 2026-06-18)
Last verified 2026-06-18

MCP Tool Description (Exact)

Run FetchXML query → markdown table. Max 5000 records, auto-paging supported. Lowercase logical names (use get_tables to verify). Don't use top/count/page in <fetch>; use max_records. See schema://fetchxml for syntax.

WHEN TO USE:
- Precise filtering / joins / aggregation across entities
- When search_records (Relevance Search) is too coarse or not enabled
- get_all=true to fetch full datasets up to max_records

Parameters

Name Type Required Default Description
fetchxml string Yes - FetchXML starting with . Lowercase logical names.
max_records integer No 5000 1–5000. Smaller (10–100) for samples.
get_all boolean No false true = auto-page till max_records. false = first page only.

Input Schema

{
  "type": "object",
  "properties": {
    "fetchxml": {
      "type": "string",
      "description": "FetchXML starting with <fetch>. Lowercase logical names."
    },
    "max_records": {
      "type": "integer",
      "description": "1–5000. Smaller (10–100) for samples.",
      "default": 5000
    },
    "get_all": {
      "type": "boolean",
      "description": "true = auto-page till max_records. false = first page only.",
      "default": false
    }
  },
  "required": [
    "fetchxml"
  ]
}

Related MCP Resources

Resource URI / URI template MIME type Reason
fetchxml_schema schema://fetchxml application/xml Mentioned in MCP metadata: Returns the XML schema defining the FetchXML query language. Structure: fetch > entity > attribute, filter, link-entity, order. Note: The execute_fetchxml tool description already provides a curated guide. This schema is for advanced/edge cases.
data_operations_guide docs://data_operations_guide text/markdown Inferred from source: Field type formats, FetchXML relationship joins, and search syntax. Read this when manage_record, execute_fetchxml, or search_records returns an error.

When To Use

  • Precise filtering / joins / aggregation across entities
  • When search_records (Relevance Search) is too coarse or not enabled
  • get_all=true to fetch full datasets up to max_records

Notes

  • Use the exact MCP description and parameter schema above as the authoritative contract.

Example

{
  "fetchxml": "string"
}

Output

Returns CallToolResult from the MCP server. The response content and structured fields follow the tool implementation and model returned by ExecuteFetchXmlTool.execute_fetchxml.

Clone this wiki locally