Skip to main content
Glama

create-account

Create new accounts in Microsoft Dynamics 365 CRM to manage customer relationships and business data through the MCP server.

Instructions

Create a new account in Dynamics 365

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountDataYes

Implementation Reference

  • MCP tool handler for 'create-account': extracts accountData from params, calls d365.createAccount, returns JSON response or error.
    async (params) => {
      try {
        const { accountData } = params;
        const response = await d365.createAccount(accountData);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(response, null, 2),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error: ${
                error instanceof Error ? error.message : "Unknown error"
              }, please check your input and try again.`,
            },
          ],
          isError: true,
        };
      }
    }
  • Input schema for the tool: accepts an object accountData with any properties.
    { accountData: z.object({}) },
  • src/tools.ts:104-134 (registration)
    Registration of the 'create-account' tool using server.tool, including name, description, schema, and handler.
    server.tool(
      "create-account",
      "Create a new account in Dynamics 365",
      { accountData: z.object({}) },
      async (params) => {
        try {
          const { accountData } = params;
          const response = await d365.createAccount(accountData);
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify(response, null, 2),
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error: ${
                  error instanceof Error ? error.message : "Unknown error"
                }, please check your input and try again.`,
              },
            ],
            isError: true,
          };
        }
      }
    );
  • Helper method in Dynamics365 class that performs the actual API POST to create account via makeApiRequest.
    public async createAccount(accountData: any): Promise<any> {
      if (!accountData) {
        throw new Error("Account data is required to create an account.");
      }
    
      const endpoint = "api/data/v9.2/accounts";
      return this.makeApiRequest(endpoint, "POST", accountData);
    }
  • Core helper for all API requests: handles auth token, constructs request, makes fetch call to Dynamics 365.
    private async makeApiRequest(
      endpoint: string,
      method: string,
      body?: any,
      additionalHeaders?: Record<string, string>
    ): Promise<any> {
      const token = await this.authenticate();
      const baseUrl = this.d365Url.endsWith("/")
        ? this.d365Url
        : `${this.d365Url}/`;
      const url = `${baseUrl}${endpoint}`;
    
      const headers: Record<string, string> = {
        Authorization: `Bearer ${token}`,
        Accept: "application/json",
        "Content-Type": "application/json",
        "OData-MaxVersion": "4.0",
        "OData-Version": "4.0",
        ...additionalHeaders,
      };
    
      try {
        const response = await fetch(url, {
          method,
          headers,
          body: body ? JSON.stringify(body) : undefined,
        });
    
        if (!response.ok) {
          throw new Error(
            `API request failed with status: ${
              response.status
            }, message: ${await response.text()}`
          );
        }
    
        return await response.json();
      } catch (error) {
        console.error(`API request to ${url} failed:`, error);
        throw new Error(
          `Failed to make API request: ${
            error instanceof Error ? error.message : String(error)
          }`
        );
      }
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a new account, implying a write operation, but fails to mention critical details such as required permissions, whether the operation is idempotent, error handling, or any side effects. This leaves significant gaps in understanding the tool's behavior.

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, clear sentence with no wasted words, making it highly concise and front-loaded. It efficiently communicates the core purpose without unnecessary elaboration, earning full marks for brevity and structure.

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 the complexity of a creation tool with no annotations, 0% schema coverage, no output schema, and nested objects, the description is incomplete. It lacks details on parameters, behavioral traits, return values, and usage context, making it insufficient for effective tool invocation without additional guesswork.

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

Parameters1/5

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

The input schema has 0% description coverage and includes one parameter 'accountData' as an empty object with additionalProperties false, making it effectively undocumented. The description provides no information about what 'accountData' should contain, its structure, or example values, failing to compensate for the schema's lack of detail.

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 ('Create') and resource ('new account in Dynamics 365'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'update-account' beyond the basic verb difference, missing explicit scope or uniqueness details.

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?

No guidance is provided on when to use this tool versus alternatives like 'update-account' or 'fetch-accounts'. The description lacks context about prerequisites, exclusions, or specific scenarios for creation, offering only a basic statement without usage instructions.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/srikanth-paladugula/mcp-dynamics365-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server