Skip to main content
Glama

get-user-info

Retrieve user details from Dynamics 365 using the Dynamics 365 MCP Server for efficient data access and management.

Instructions

Get user info from Dynamics 365

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler function for the "get-user-info" tool. Fetches user info using d365.makeWhoAmIRequest() and returns formatted text response or error.
    async () => { try { const response = await d365.makeWhoAmIRequest(); return { content: [ { type: "text", text: `Hi ${response.FullName}, your user ID is ${response.UserId} and your business unit ID is ${response.BusinessUnitId}`, }, ], }; } 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:7-36 (registration)
    Registration of the "get-user-info" tool using McpServer.tool() with name, description, empty input schema, and inline handler.
    server.tool( "get-user-info", "Get user info from Dynamics 365", {}, async () => { try { const response = await d365.makeWhoAmIRequest(); return { content: [ { type: "text", text: `Hi ${response.FullName}, your user ID is ${response.UserId} and your business unit ID is ${response.BusinessUnitId}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : "Unknown error" }, please check your credentials and try again.`, }, ], isError: true, }; } } );
  • Helper method makeWhoAmIRequest() in Dynamics365 class that queries Dynamics 365 API for current user's WhoAmI and additional user details.
    public async makeWhoAmIRequest(): Promise<{ BusinessUnitId: string; UserId: string; OrganizationId: string; UserName?: string; FullName?: string; }> { const data = await this.makeApiRequest("api/data/v9.2/WhoAmI", "GET"); // If we want to get more details about the user, we can make an additional request if (data && data.UserId) { const userDetails = await this.makeApiRequest( `api/data/v9.2/systemusers(${data.UserId})`, "GET", undefined, { Prefer: 'odata.include-annotations="*"' } ); data.UserName = userDetails.domainname; data.FullName = userDetails.fullname; } return data; }

Other Tools

Related 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