Skip to main content
Glama

list_accounts

Retrieve all signed-in Microsoft accounts using the MCP server, enabling AI assistants to interact with Microsoft services via natural language commands.

Instructions

List all signed-in Microsoft accounts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler for list_accounts, decorated with @mcp.tool. It lists all signed-in Microsoft accounts by calling the auth.list_accounts() helper and formatting the results as a list of dicts with username and account_id.
    @mcp.tool def list_accounts() -> list[dict[str, str]]: """List all signed-in Microsoft accounts""" return [ {"username": acc.username, "account_id": acc.account_id} for acc in auth.list_accounts() ]
  • Supporting helper function that retrieves accounts from the MSAL PublicClientApplication's token cache and returns them as a list of Account namedtuples (username and account_id). Used by the list_accounts tool handler.
    def list_accounts() -> list[Account]: app = get_app() return [ Account(username=a["username"], account_id=a["home_account_id"]) for a in app.get_accounts() ]
  • Import of mcp from tools.py in server.py, which registers all @mcp.tool decorated functions when the module is imported before mcp.run() is called.
    from .tools import mcp

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/elyxlz/microsoft-mcp'

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