fetch-accounts
Retrieve account data from Dynamics 365 to access customer information and manage business relationships.
Instructions
Fetch accounts from Dynamics 365
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:43-68 (handler)The inline handler function registered for the 'fetch-accounts' tool. It calls d365.getAccounts(), formats the accounts as JSON, and returns as text content or an error response.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-42 (registration)Registration of the 'fetch-accounts' tool with the MCP server, specifying name, description, and empty input schema.server.tool( "fetch-accounts", "Fetch accounts from Dynamics 365", {},
- src/main.ts:180-182 (helper)Helper method in Dynamics365 class that performs the API request to fetch all accounts from Dynamics 365 Web API endpoint.public async getAccounts(): Promise<any> { return this.makeApiRequest("api/data/v9.2/accounts", "GET"); }