Skip to main content
Glama

get_me

Retrieve authenticated user details including ID, display name, and email from Azure DevOps for identity verification and access management.

Instructions

Get details of the authenticated user (id, displayName, email)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that implements the get_me tool logic by fetching the authenticated user's profile from the Azure DevOps Profile API using axios and appropriate authentication.
    export async function getMe(connection: WebApi): Promise<UserProfile> { try { // Extract organization from the connection URL const { organization } = extractOrgFromUrl(connection.serverUrl); // Get the authorization header const authHeader = await getAuthorizationHeader(); // Make direct call to the Profile API endpoint // Note: This API is in the vssps.dev.azure.com domain, not dev.azure.com const response = await axios.get( `https://vssps.dev.azure.com/${organization}/_apis/profile/profiles/me?api-version=7.1`, { headers: { Authorization: authHeader, 'Content-Type': 'application/json', }, }, ); const profile = response.data; // Return the user profile with required fields return { id: profile.id, displayName: profile.displayName || '', email: profile.emailAddress || '', }; } catch (error) { // Handle authentication errors if ( axios.isAxiosError(error) && (error.response?.status === 401 || error.response?.status === 403) ) { throw new AzureDevOpsAuthenticationError( `Authentication failed: ${error.message}`, ); } // If it's already an AzureDevOpsError, rethrow it if (error instanceof AzureDevOpsError) { throw error; } // Otherwise, wrap it in a generic error throw new AzureDevOpsError( `Failed to get user information: ${error instanceof Error ? error.message : String(error)}`, ); }
  • Registration of the get_me tool in the usersTools array, including name, description, and input schema derived from Zod schema.
    export const usersTools: ToolDefinition[] = [ { name: 'get_me', description: 'Get details of the authenticated user (id, displayName, email)', inputSchema: zodToJsonSchema(GetMeSchema), }, ];
  • Zod input schema for the get_me tool, which requires no parameters (empty object).
    export const GetMeSchema = z.object({}).strict();
  • MCP request handler for users tools, dispatching to getMe for 'get_me' tool name and formatting response as MCP content.
    export const handleUsersRequest: RequestHandler = async ( connection: WebApi, request: CallToolRequest, ): Promise<{ content: Array<{ type: string; text: string }> }> => { switch (request.params.name) { case 'get_me': { const result = await getMe(connection); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } default: throw new Error(`Unknown users tool: ${request.params.name}`); } };
  • Request identifier function that checks if the tool name is 'get_me' to route to users feature.
    export const isUsersRequest: RequestIdentifier = ( request: CallToolRequest, ): boolean => { const toolName = request.params.name; return ['get_me'].includes(toolName); };

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/Tiberriver256/mcp-server-azure-devops'

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