list_email_accounts
Lists configured email accounts, including account labels, provider types, and all email addresses and aliases.
Instructions
List configured email accounts.
Each entry includes:
name: the account LABEL used as the
accountargument in other toolskind: provider class (ImapEmailProvider / GmailProvider)
addresses: every email address this mailbox receives mail at — the primary login address PLUS any configured aliases. Use these when answering 'who emailed me at X?' questions; the
nameis NOT the user's email address.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/productivity_mcp/server.py:96-110 (handler)The actual tool handler function for list_email_accounts. It returns a list of dicts with name, kind, and addresses from _email_providers.
def list_email_accounts() -> list[dict[str, Any]]: """List configured email accounts. Each entry includes: - name: the account LABEL used as the `account` argument in other tools - kind: provider class (ImapEmailProvider / GmailProvider) - addresses: every email address this mailbox receives mail at — the primary login address PLUS any configured aliases. Use these when answering 'who emailed me at X?' questions; the `name` is NOT the user's email address. """ return [ {"name": name, "kind": p.__class__.__name__, "addresses": list(getattr(p, "addresses", []) or [])} for name, p in _email_providers.items() ] - src/productivity_mcp/server.py:94-96 (registration)The tool is registered via the @mcp.tool() decorator on line 94 and the @_logged decorator on line 95, which wraps the function for logging and rate-limiting.
@mcp.tool() @_logged def list_email_accounts() -> list[dict[str, Any]]: - src/productivity_mcp/server.py:54-55 (helper)The _email_providers dict that stores the configured email providers, which list_email_accounts reads from.
_email_providers: dict[str, EmailProvider] = {} _calendar_providers: dict[str, CalendarProvider] = {} - The return type is list[dict[str, Any]] and the function takes no arguments, as defined in the handler signature.
def list_email_accounts() -> list[dict[str, Any]]: """List configured email accounts. Each entry includes: - name: the account LABEL used as the `account` argument in other tools - kind: provider class (ImapEmailProvider / GmailProvider) - addresses: every email address this mailbox receives mail at — the primary login address PLUS any configured aliases. Use these when answering 'who emailed me at X?' questions; the `name` is NOT the user's email address. """ return [ {"name": name, "kind": p.__class__.__name__, "addresses": list(getattr(p, "addresses", []) or [])} for name, p in _email_providers.items() ] - src/productivity_mcp/server.py:58-63 (helper)The _load() function populates _email_providers, which list_email_accounts depends on.
def _load() -> None: cfg = load_config() for acct in cfg.email_accounts: _email_providers[acct.name] = build_email_provider(acct) for acct in cfg.calendar_accounts: _calendar_providers[acct.name] = build_calendar_provider(acct)