Skip to main content
Glama

list-accounts

Retrieve all Microsoft accounts accessible through the ForIT Microsoft Graph server to manage Microsoft 365 services across multiple tenants.

Instructions

List all available Microsoft accounts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration of the 'list-accounts' MCP tool, including description, empty input schema, and handler function that lists accounts via AuthManager and returns formatted JSON.
    server.tool('list-accounts', 'List all available Microsoft accounts', {}, async () => {
      try {
        const accounts = await authManager.listAccounts();
        // No 'selected' field - accountId is always required when multiple accounts exist
        const result = accounts.map((account) => ({
          id: account.homeAccountId,
          username: account.username,
          name: account.name,
        }));
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ accounts: result }),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: `Failed to list accounts: ${(error as Error).message}` }),
            },
          ],
        };
      }
    });
  • The inline async handler function for the 'list-accounts' tool that executes the logic: fetches accounts from AuthManager, maps to id/username/name, and returns as MCP content.
    server.tool('list-accounts', 'List all available Microsoft accounts', {}, async () => {
      try {
        const accounts = await authManager.listAccounts();
        // No 'selected' field - accountId is always required when multiple accounts exist
        const result = accounts.map((account) => ({
          id: account.homeAccountId,
          username: account.username,
          name: account.name,
        }));
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ accounts: result }),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify({ error: `Failed to list accounts: ${(error as Error).message}` }),
            },
          ],
        };
      }
    });
  • Supporting method in AuthManager class that retrieves all cached Microsoft accounts from the MSAL token cache.
    async listAccounts(): Promise<AccountInfo[]> {
      return await this.msalApp.getTokenCache().getAllAccounts();
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states the action without disclosing behavioral traits such as whether it requires authentication, returns paginated results, or includes inactive accounts. It's a basic statement that leaves critical operational details unspecified.

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 that directly states the tool's function without any unnecessary words. It's front-loaded and wastes no space, making it highly concise and well-structured for its purpose.

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

Completeness3/5

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

Given the tool's simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks context on authentication needs, return format, or sibling differentiation. It meets basic requirements but doesn't fully compensate for the absence of structured data.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't add parameter details, aligning with the schema's completeness, though it could hint at implicit context like authentication requirements.

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 verb ('List') and resource ('all available Microsoft accounts'), making the purpose unambiguous. It doesn't differentiate from siblings like 'select-account' or 'remove-account', which would require more specific scope or filtering details.

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 like 'select-account' for choosing a specific account or 'verify-login' for authentication checks. The description implies a general listing function but lacks explicit context or exclusions.

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