Skip to main content
Glama

verify-login

Check current Microsoft authentication status to verify login validity before accessing Microsoft 365 services across multiple tenants.

Instructions

Check current Microsoft authentication status

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The inline handler and registration for the 'verify-login' MCP tool. It calls AuthManager.testLogin() and returns the result as a text content block with JSON stringified response.
    server.tool('verify-login', 'Check current Microsoft authentication status', {}, async () => { const testResult = await authManager.testLogin(); return { content: [ { type: 'text', text: JSON.stringify(testResult), }, ], }; });
  • The core helper method AuthManager.testLogin() that implements the login verification logic: acquires an access token, tests it against the Microsoft Graph /me endpoint, and returns a structured result indicating success and user info.
    async testLogin(): Promise<LoginTestResult> { try { logger.info('Testing login...'); const token = await this.getToken(); if (!token) { logger.error('Login test failed - no token received'); return { success: false, message: 'Login failed - no token received', }; } logger.info('Token retrieved successfully, testing Graph API access...'); try { const response = await fetch('https://graph.microsoft.com/v1.0/me', { headers: { Authorization: `Bearer ${token}`, }, }); if (response.ok) { const userData = await response.json(); logger.info('Graph API user data fetch successful'); return { success: true, message: 'Login successful', userData: { displayName: userData.displayName, userPrincipalName: userData.userPrincipalName, }, }; } else { const errorText = await response.text(); logger.error(`Graph API user data fetch failed: ${response.status} - ${errorText}`); return { success: false, message: `Login successful but Graph API access failed: ${response.status}`, }; } } catch (graphError) { logger.error(`Error fetching user data: ${(graphError as Error).message}`); return { success: false, message: `Login successful but Graph API access failed: ${(graphError as Error).message}`, }; } } catch (error) { logger.error(`Login test failed: ${(error as Error).message}`); return { success: false, message: `Login failed: ${(error as Error).message}`, }; } }
  • Type definition for the LoginTestResult returned by testLogin(), defining the output structure used by the verify-login tool.
    interface LoginTestResult { success: boolean; message: string; userData?: { displayName: string; userPrincipalName: string; }; }

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/ForITLLC/forit-microsoft-graph'

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