Skip to main content
Glama

logout

Sign out of your Microsoft account to end the current session.

Instructions

Log out from Microsoft account

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool registration for 'logout' – defines the tool handler that calls authManager.logout() and returns success/failure JSON 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 actual logout logic: clears MSAL token cache accounts, removes cached token/account data from storage, and resets in-memory state.
    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;
    
        await this.storage.delete('token-cache');
        await this.storage.delete('selected-account');
    
        return true;
      } catch (error) {
        logger.error(`Error during logout: ${(error as Error).message}`);
        throw error;
      }
    }
  • The 'logout' tool is registered via server.tool() in the registerAuthTools function in src/auth-tools.ts.
    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 'logout' tool's schema: no input parameters (empty object {}) and returns JSON text content.
    server.tool('logout', 'Log out from Microsoft account', {}, async () => {
  • CLI option definition for --logout flag used outside MCP tool mode (non-HTTP/stdio CLI mode).
    .option('--logout', 'Log out and clear saved credentials')
Behavior2/5

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

No annotations are provided, and the description does not disclose behavioral traits like token invalidation, impact on other tools, or side effects. It only states the basic function.

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 concise sentence that front-loads the action and resource. Every word earns its place with no redundancy.

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

Completeness4/5

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

For a simple logout tool with no parameters or output schema, the description is mostly complete. It could explicitly mention that it ends the authenticated session, but the current wording is adequate.

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?

There are no parameters in the input schema, so the description does not need to add meaning. With 0 parameters, baseline is 4, and the description suffices.

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

Purpose5/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 resource (Microsoft account), which is specific and distinguishes from sibling tools like login or select-account.

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?

No guidance is provided on when to use this tool versus alternatives, such as when the agent should end the session or if there are prerequisites. The description lacks any usage context.

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/Softeria/ms-365-mcp-server'

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