Skip to main content
Glama

logout

Ends the current Microsoft account session in ForIT Microsoft Graph, disconnecting access to Microsoft 365 services across managed tenants.

Instructions

Log out from Microsoft account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registers the 'logout' tool with the MCP server. Includes empty input schema and an inline handler that calls authManager.logout() to perform the logout and returns a text response with success or error message.
    server.tool('logout', 'Log out from Microsoft account', {}, async () => {
      try {
        await authManager.logout();
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ message: 'Logged out successfully' }),
            },
          ],
        };
      } catch {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: 'Logout failed' }),
            },
          ],
        };
      }
    });
  • The inline handler function for the logout tool that executes the core logic: invokes authManager.logout() and formats the MCP response.
    server.tool('logout', 'Log out from Microsoft account', {}, async () => {
      try {
        await authManager.logout();
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ message: 'Logged out successfully' }),
            },
          ],
        };
      } catch {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: 'Logout failed' }),
            },
          ],
        };
      }
    });
  • The AuthManager.logout() helper method that clears all accounts from MSAL token cache, removes credentials from keytar/file storage, clears internal state, and handles errors.
    async logout(): Promise<boolean> {
      try {
        const accounts = await this.msalApp.getTokenCache().getAllAccounts();
        for (const account of accounts) {
          await this.msalApp.getTokenCache().removeAccount(account);
        }
        this.accessToken = null;
        this.tokenExpiry = null;
        this.selectedAccountId = null;
    
        try {
          const kt = await getKeytar();
          if (kt) {
            await kt.deletePassword(SERVICE_NAME, TOKEN_CACHE_ACCOUNT);
            await kt.deletePassword(SERVICE_NAME, SELECTED_ACCOUNT_KEY);
          }
        } catch (keytarError) {
          logger.warn(`Keychain deletion failed: ${(keytarError as Error).message}`);
        }
    
        if (fs.existsSync(FALLBACK_PATH)) {
          fs.unlinkSync(FALLBACK_PATH);
        }
    
        if (fs.existsSync(SELECTED_ACCOUNT_PATH)) {
          fs.unlinkSync(SELECTED_ACCOUNT_PATH);
        }
    
        return true;
      } catch (error) {
        logger.error(`Error during logout: ${(error as Error).message}`);
        throw error;
      }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('Log out') but doesn't disclose behavioral traits like whether this invalidates all sessions, requires specific permissions, affects other tools, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is inadequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool (logout implies state change) with no annotations and no output schema, the description is incomplete. It doesn't explain what the tool returns, error conditions, or side effects, leaving significant gaps for agent understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description doesn't need to add parameter semantics, earning a baseline score of 4 for tools with no parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Log out') and target resource ('from Microsoft account'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'remove-account' or 'verify-login', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'remove-account' (which might delete account data) or 'verify-login' (which checks login status). It also doesn't mention prerequisites such as needing to be logged in first, leaving usage context unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ForITLLC/m365-mcp-suite'

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