Skip to main content
Glama

get_user

Retrieve user profile details including name, email, job title, and department using their ID or email address with Teams MCP's integration.

Instructions

Get detailed information about a specific user by their ID or email address. Returns profile information including name, email, job title, and department.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
userIdYesUser ID or email address

Implementation Reference

  • The core handler function implementing the 'get_user' tool logic. Fetches user profile from Microsoft Graph using the provided userId (supports ID or email), formats as UserSummary, returns JSON stringified text response or error.
    async ({ userId }) => { try { const client = await graphService.getClient(); const user = (await client.api(`/users/${userId}`).get()) as User; const userSummary: UserSummary = { displayName: user.displayName, userPrincipalName: user.userPrincipalName, mail: user.mail, id: user.id, jobTitle: user.jobTitle, department: user.department, officeLocation: user.officeLocation, }; return { content: [ { type: "text", text: JSON.stringify(userSummary, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } }
  • Input validation schema for 'get_user' tool using Zod: requires 'userId' as string (User ID or email).
    { userId: z.string().describe("User ID or email address"), },
  • Registration of the 'get_user' MCP tool within registerUsersTools function, specifying name, description, Zod schema, and inline handler.
    server.tool( "get_user", "Get detailed information about a specific user by their ID or email address. Returns profile information including name, email, job title, and department.", { userId: z.string().describe("User ID or email address"), }, async ({ userId }) => { try { const client = await graphService.getClient(); const user = (await client.api(`/users/${userId}`).get()) as User; const userSummary: UserSummary = { displayName: user.displayName, userPrincipalName: user.userPrincipalName, mail: user.mail, id: user.id, jobTitle: user.jobTitle, department: user.department, officeLocation: user.officeLocation, }; return { content: [ { type: "text", text: JSON.stringify(userSummary, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } } );

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/floriscornel/teams-mcp'

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