create-account
Create new accounts in Dynamics 365 to manage customer data and relationships within the CRM system.
Instructions
Create a new account in Dynamics 365
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountData | Yes |
Implementation Reference
- src/tools.ts:103-134 (handler)Full registration of the 'create-account' MCP tool, including description, minimal input schema allowing any accountData object, and the handler function that calls the Dynamics365 helper and formats the result as text content.// Register the "create-account" tool 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, }; } } );
- src/main.ts:214-221 (helper)Helper method in the Dynamics365 class that validates input and makes a POST API request to create a new account entity in Dynamics 365 Web API.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); }