Skip to main content
Glama
ai-zerolab

MCP Email Server

by ai-zerolab

list_available_accounts

Lists all configured email accounts, displaying masked credentials for security.

Instructions

List all configured email accounts with masked credentials.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The actual handler function for the 'list_available_accounts' MCP tool. It retrieves all configured email and provider accounts via get_settings().get_accounts() and returns them with masked credentials.
    @mcp.tool(description="List all configured email accounts with masked credentials.")
    async def list_available_accounts() -> list[AccountAttributes]:
        settings = get_settings()
        return [account.masked() for account in settings.get_accounts()]
  • The tool is registered as an MCP tool via the @mcp.tool decorator on the FastMCP instance named 'mcp'.
    @mcp.tool(description="List all configured email accounts with masked credentials.")
  • The AccountAttributes Pydantic base model that defines the schema for accounts returned by list_available_accounts. Includes a masked() method.
    class AccountAttributes(BaseModel):
        model_config = ConfigDict(json_encoders={datetime.datetime: lambda v: v.isoformat()})
        account_name: str
        description: str = ""
        created_at: datetime.datetime = Field(default_factory=lambda: datetime.datetime.now(ZoneInfo("UTC")))
        updated_at: datetime.datetime = Field(default_factory=lambda: datetime.datetime.now(ZoneInfo("UTC")))
    
        @model_validator(mode="after")
        @classmethod
        def update_updated_at(cls, obj: AccountAttributes) -> AccountAttributes:
            """Update updated_at field."""
            # must disable validation to avoid infinite loop
            obj.model_config["validate_assignment"] = False
    
            # update updated_at field
            obj.updated_at = datetime.datetime.now(ZoneInfo("UTC"))
    
            # enable validation again
            obj.model_config["validate_assignment"] = True
            return obj
    
        def __eq__(self, other: object) -> bool:
            if not isinstance(other, AccountAttributes):
                return NotImplemented
            return self.model_dump(exclude={"created_at", "updated_at"}) == other.model_dump(
                exclude={"created_at", "updated_at"}
            )
    
        @field_serializer("created_at", "updated_at")
        def serialize_datetime(self, v: datetime.datetime) -> str:
            return v.isoformat()
    
        def masked(self) -> AccountAttributes:
            return self.model_copy()
  • The Settings.get_accounts() helper method that combines emails and providers into a single list. Called by the tool handler to retrieve all accounts.
    def get_accounts(self, masked: bool = False) -> list[EmailSettings | ProviderSettings]:
        accounts = self.emails + self.providers
        if masked:
            return [account.masked() for account in accounts]
        return accounts
  • The singleton helper that provides the Settings instance to the tool handler.
    def get_settings(reload: bool = False) -> Settings:
        global _settings
        if not _settings or reload:
            logger.info(f"Loading settings from {CONFIG_PATH}")
            _settings = Settings()
        return _settings
Behavior2/5

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

Only mentions credentials are masked; no disclosure about side effects, authentication needs, or safety, and no annotations provided.

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?

Single sentence, concise, and front-loaded with the core action.

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?

Sufficient for a simple parameterless tool with an output schema; minimal but 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?

No parameters, so description doesn't need to add info; baseline 4 applies.

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?

Clearly states it lists all configured email accounts with masked credentials, distinguishing it from siblings that handle individual email operations.

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

Usage Guidelines3/5

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

Implied usage as a utility to view available accounts, but no explicit guidance on when to use or alternatives.

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/ai-zerolab/mcp-email-server'

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