Skip to main content
Glama
srikanth-paladugula

Dynamics 365 MCP Server

fetch-accounts

Retrieve account data from Dynamics 365 to access customer information and business details for analysis and management.

Instructions

Fetch accounts from Dynamics 365

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline async handler function for the "fetch-accounts" tool. It calls d365.getAccounts() to fetch accounts, stringifies the response.value as JSON, and returns it as text content. Includes try-catch error handling returning an error message.
      async () => {
        try {
          const response = await d365.getAccounts();
          const accounts = JSON.stringify(response.value, null, 2);
          return {
            content: [
              {
                type: "text",
                text: accounts,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : "Unknown error"
                }, please check your credentials and try again.`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • src/tools.ts:39-69 (registration)
    The server.tool() call that registers the "fetch-accounts" tool with the MCP server, including name, description, empty input schema ({}), and the handler function.
    server.tool(
      "fetch-accounts",
      "Fetch accounts from Dynamics 365",
      {},
      async () => {
        try {
          const response = await d365.getAccounts();
          const accounts = JSON.stringify(response.value, null, 2);
          return {
            content: [
              {
                type: "text",
                text: accounts,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : "Unknown error"
                }, please check your credentials and try again.`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • The getAccounts() method in the Dynamics365 class, which performs a GET request to the /api/data/v9.2/accounts endpoint using the private makeApiRequest method, handling authentication.
    public async getAccounts(): Promise<any> {
      return this.makeApiRequest("api/data/v9.2/accounts", "GET");
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.0.0

TDQS

B3.1/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states 'fetch' implies a read operation, but doesn't disclose behavioral traits such as permissions needed, rate limits, pagination, or what 'accounts' includes (e.g., all accounts or filtered). This leaves significant gaps for an agent.

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

Conciseness5/5

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

The description is a single, efficient sentence with no wasted words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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

Completeness2/5

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

Given no annotations, no output schema, and a read operation with potential complexity (e.g., fetching accounts could involve filters or pagination), the description is incomplete. It lacks details on behavior, return values, or context needed for effective use.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add param info, which is fine here. Baseline is 4 for 0 params, as it doesn't need to compensate for any gaps.

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 the action ('fetch') and resource ('accounts from Dynamics 365'), making the tool's purpose understandable. However, it doesn't differentiate from sibling tools like 'get-associated-opportunities' or 'get-user-info', which might also retrieve data, so it's not fully specific.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'create-account' and 'update-account', it's implied for read operations, but there's no explicit context, exclusions, or named alternatives mentioned.

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