Skip to main content
Glama
Racimy

iMail-mcp

check_config

Verify environment variables are correctly set for iMail-mcp server to retrieve mail from iCloud.

Instructions

Check if environment variables are properly configured

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler for the 'check_config' tool. Checks if ICLOUD_EMAIL and ICLOUD_APP_PASSWORD environment variables are set, masks their values for security, determines connection status, and returns the configuration status as JSON.
    case 'check_config': {
      const maskCredential = (value: string | undefined) => {
        if (!value) return 'Not set';
        if (value.length <= 4) return '***';
        return value.substring(0, 4) + '***';
      };
    
      const config = {
        email: {
          value: maskCredential(process.env.ICLOUD_EMAIL),
          configured: !!process.env.ICLOUD_EMAIL,
        },
        appPassword: {
          value: maskCredential(process.env.ICLOUD_APP_PASSWORD),
          configured: !!process.env.ICLOUD_APP_PASSWORD,
        },
        connectionStatus: mailClient ? 'Connected' : 'Not connected',
      };
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(config, null, 2),
          },
        ],
      };
    }
  • Input schema and metadata for the 'check_config' tool, defining it as taking no arguments.
    {
      name: 'check_config',
      description: 'Check if environment variables are properly configured',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/index.ts:54-383 (registration)
    Registers the 'check_config' tool by including it in the tools list returned by ListToolsRequestHandler.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          {
            name: 'get_messages',
            description: 'Get email messages from specified mailbox',
            inputSchema: {
              type: 'object',
              properties: {
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
                limit: {
                  type: 'number',
                  description: 'Maximum number of messages to retrieve',
                  default: 10,
                },
                unreadOnly: {
                  type: 'boolean',
                  description: 'Retrieve only unread messages',
                  default: false,
                },
              },
            },
          },
          {
            name: 'send_email',
            description: 'Send an email through iCloud Mail',
            inputSchema: {
              type: 'object',
              properties: {
                to: {
                  oneOf: [
                    { type: 'string' },
                    { type: 'array', items: { type: 'string' } },
                  ],
                  description: 'Recipient email address(es)',
                },
                subject: {
                  type: 'string',
                  description: 'Email subject',
                },
                text: {
                  type: 'string',
                  description: 'Plain text email body',
                },
                html: {
                  type: 'string',
                  description: 'HTML email body',
                },
              },
              required: ['to', 'subject'],
            },
          },
          {
            name: 'mark_as_read',
            description: 'Mark email messages as read',
            inputSchema: {
              type: 'object',
              properties: {
                messageIds: {
                  type: 'array',
                  items: { type: 'string' },
                  description: 'Array of message IDs to mark as read',
                },
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
              },
              required: ['messageIds'],
            },
          },
          {
            name: 'get_mailboxes',
            description: 'List all available mailboxes',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'test_connection',
            description: 'Test the email server connection (IMAP and SMTP)',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
          {
            name: 'create_mailbox',
            description: 'Create a new mailbox (folder)',
            inputSchema: {
              type: 'object',
              properties: {
                name: {
                  type: 'string',
                  description: 'Name of the mailbox to create',
                },
              },
              required: ['name'],
            },
          },
          {
            name: 'delete_mailbox',
            description: 'Delete an existing mailbox (folder)',
            inputSchema: {
              type: 'object',
              properties: {
                name: {
                  type: 'string',
                  description: 'Name of the mailbox to delete',
                },
              },
              required: ['name'],
            },
          },
          {
            name: 'move_messages',
            description: 'Move messages between mailboxes',
            inputSchema: {
              type: 'object',
              properties: {
                messageIds: {
                  type: 'array',
                  items: { type: 'string' },
                  description: 'Array of message IDs to move',
                },
                sourceMailbox: {
                  type: 'string',
                  description: 'Source mailbox name',
                },
                destinationMailbox: {
                  type: 'string',
                  description: 'Destination mailbox name',
                },
              },
              required: ['messageIds', 'sourceMailbox', 'destinationMailbox'],
            },
          },
          {
            name: 'search_messages',
            description: 'Search for messages using various criteria',
            inputSchema: {
              type: 'object',
              properties: {
                query: {
                  type: 'string',
                  description:
                    'Search query text (searches in subject, from, body)',
                },
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
                limit: {
                  type: 'number',
                  description: 'Maximum number of messages to retrieve',
                  default: 10,
                },
                dateFrom: {
                  type: 'string',
                  description: 'Start date for search (YYYY-MM-DD format)',
                },
                dateTo: {
                  type: 'string',
                  description: 'End date for search (YYYY-MM-DD format)',
                },
                fromEmail: {
                  type: 'string',
                  description: 'Filter by sender email address',
                },
                unreadOnly: {
                  type: 'boolean',
                  description: 'Search only unread messages',
                  default: false,
                },
              },
            },
          },
          {
            name: 'delete_messages',
            description: 'Delete messages from a mailbox',
            inputSchema: {
              type: 'object',
              properties: {
                messageIds: {
                  type: 'array',
                  items: { type: 'string' },
                  description: 'Array of message IDs to delete',
                },
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
              },
              required: ['messageIds'],
            },
          },
          {
            name: 'set_flags',
            description: 'Set flags on messages (read, unread, flagged, etc.)',
            inputSchema: {
              type: 'object',
              properties: {
                messageIds: {
                  type: 'array',
                  items: { type: 'string' },
                  description: 'Array of message IDs to set flags on',
                },
                flags: {
                  type: 'array',
                  items: { type: 'string' },
                  description:
                    'Array of flags to set (e.g., ["\\Seen", "\\Flagged"])',
                },
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
                action: {
                  type: 'string',
                  enum: ['add', 'remove'],
                  description: 'Whether to add or remove the flags (default: add)',
                  default: 'add',
                },
              },
              required: ['messageIds', 'flags'],
            },
          },
          {
            name: 'download_attachment',
            description: 'Download an attachment from a specific message',
            inputSchema: {
              type: 'object',
              properties: {
                messageId: {
                  type: 'string',
                  description: 'Message ID containing the attachment',
                },
                attachmentIndex: {
                  type: 'number',
                  description: 'Index of the attachment to download (0-based)',
                  default: 0,
                },
                mailbox: {
                  type: 'string',
                  description: 'Mailbox name (default: INBOX)',
                  default: 'INBOX',
                },
              },
              required: ['messageId'],
            },
          },
          {
            name: 'auto_organize',
            description:
              'Automatically organize emails based on rules (sender, subject keywords, etc.)',
            inputSchema: {
              type: 'object',
              properties: {
                rules: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      name: {
                        type: 'string',
                        description: 'Rule name',
                      },
                      condition: {
                        type: 'object',
                        properties: {
                          fromContains: {
                            type: 'string',
                            description: 'Move emails if sender contains this text',
                          },
                          subjectContains: {
                            type: 'string',
                            description:
                              'Move emails if subject contains this text',
                          },
                        },
                      },
                      action: {
                        type: 'object',
                        properties: {
                          moveToMailbox: {
                            type: 'string',
                            description: 'Mailbox to move matching emails to',
                          },
                        },
                        required: ['moveToMailbox'],
                      },
                    },
                    required: ['name', 'condition', 'action'],
                  },
                  description: 'Array of organization rules',
                },
                sourceMailbox: {
                  type: 'string',
                  description: 'Source mailbox to organize (default: INBOX)',
                  default: 'INBOX',
                },
                dryRun: {
                  type: 'boolean',
                  description:
                    'If true, only shows what would be organized without moving emails',
                  default: false,
                },
              },
              required: ['rules'],
            },
          },
          {
            name: 'check_config',
            description: 'Check if environment variables are properly configured',
            inputSchema: {
              type: 'object',
              properties: {},
            },
          },
        ],
      };
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states what the tool does but doesn't disclose behavioral traits like what 'properly configured' means, what happens if configuration is invalid, whether it's read-only or has side effects, or what the output format might be. For a tool with zero annotation coverage, this is insufficient.

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 communicates the core purpose without any wasted words. It's appropriately sized for a zero-parameter tool and gets straight to the point.

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

Completeness2/5

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

Given no annotations, no output schema, and the description's limited behavioral disclosure, this is incomplete for a configuration checking tool. It doesn't explain what 'properly configured' means, what validation criteria are used, or what format the result takes. The description should provide more context about the checking behavior.

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 tool has zero parameters with 100% schema description coverage, so the baseline is 4. The description doesn't need to compensate for any parameter documentation gaps since there are no parameters to document.

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 tool's purpose: checking if environment variables are properly configured. It uses a specific verb ('check') and resource ('environment variables'), but doesn't differentiate from sibling tools, which are all email-related while this is a configuration tool.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, timing considerations, or relationship to sibling tools. The context suggests it's for configuration validation, but no explicit usage context is provided.

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/Racimy/iMail-mcp'

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