Skip to main content
Glama

get_current_user

Retrieve the current authenticated user’s profile details, such as display name, email, job title, and department, directly from Microsoft Teams via Microsoft Graph APIs.

Instructions

Get the current authenticated user's profile information including display name, email, job title, and department.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the 'get_current_user' tool using server.tool(). The inline handler fetches the current user's profile from Microsoft Graph API (/me endpoint), extracts relevant fields into UserSummary, and returns as JSON text content. Handles errors by returning error message.
    server.tool( "get_current_user", "Get the current authenticated user's profile information including display name, email, job title, and department.", {}, async () => { try { const client = await graphService.getClient(); const user = (await client.api("/me").get()) as User; const userSummary: UserSummary = { displayName: user.displayName, userPrincipalName: user.userPrincipalName, mail: user.mail, id: user.id, jobTitle: user.jobTitle, department: user.department, }; 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}`, }, ], }; } } );
  • Handler function for get_current_user tool: obtains Graph client, calls /me endpoint, maps to UserSummary, returns JSON stringified in text content. Catches and reports errors.
    async () => { try { const client = await graphService.getClient(); const user = (await client.api("/me").get()) as User; const userSummary: UserSummary = { displayName: user.displayName, userPrincipalName: user.userPrincipalName, mail: user.mail, id: user.id, jobTitle: user.jobTitle, department: user.department, }; 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