Skip to main content
Glama
TimeCyber

Email MCP Server

by TimeCyber

test_email_connection

Test SMTP and IMAP connections to verify email server functionality for sending and receiving messages.

Instructions

测试邮箱服务器连接

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testTypeNo测试类型:smtp(发送)、imap(接收)或both(全部)

Implementation Reference

  • The testConnection method implements the core logic for testing email server connections. It verifies SMTP using nodemailer's transporter.verify() and tests IMAP by attempting to connect and open the INBOX. Supports testing 'smtp', 'imap', or 'both' based on input.
    async testConnection(args = {}) {
      const { testType = 'both' } = args;
      let results = [];
    
      try {
        // 测试SMTP连接
        if (testType === 'smtp' || testType === 'both') {
          try {
            const transporter = this.createSMTPTransporter();
            await transporter.verify();
            results.push('✅ SMTP服务器连接测试成功!');
          } catch (error) {
            results.push(`❌ SMTP连接测试失败: ${error.message}`);
          }
        }
    
        // 测试IMAP连接
        if (testType === 'imap' || testType === 'both') {
          try {
            await new Promise((resolve, reject) => {
              const imap = this.createIMAPConnection();
              
              imap.once('ready', () => {
                imap.end();
                resolve();
              });
              
              imap.once('error', (err) => {
                reject(err);
              });
              
              imap.connect();
            });
            results.push('✅ IMAP服务器连接测试成功!');
          } catch (error) {
            results.push(`❌ IMAP连接测试失败: ${error.message}`);
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: results.join('\n')
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ 测试失败: ${error.message}`
            }
          ]
        };
      }
    }
  • The input schema for the test_email_connection tool, defining an optional testType parameter with enum values 'smtp', 'imap', or 'both'.
    {
      name: 'test_email_connection',
      description: '测试邮箱服务器连接',
      inputSchema: {
        type: 'object',
        properties: {
          testType: {
            type: 'string',
            enum: ['smtp', 'imap', 'both'],
            description: '测试类型:smtp(发送)、imap(接收)或both(全部)'
          }
        },
        required: []
      }
    }
  • index.js:358-359 (registration)
    The switch case in the CallToolRequestSchema handler that registers and dispatches calls to the test_email_connection tool by invoking the testConnection method.
    case 'test_email_connection':
      return await this.testConnection(args);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool tests connections but doesn't explain what 'testing' entails—e.g., whether it performs authentication checks, network pings, or returns diagnostic details. It also omits critical behavioral traits like error handling, timeouts, or if it modifies server state (though 'test' implies read-only). For a tool with zero annotation coverage, this is a significant gap in transparency.

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 phrase ('测试邮箱服务器连接') that directly states the tool's purpose without unnecessary words. It's appropriately sized for a simple tool and front-loaded with the core action. Every part of the description earns its place by conveying essential intent.

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 the tool's complexity (involving server testing) and lack of annotations or output schema, the description is incomplete. It doesn't explain what the test does, what results to expect (e.g., success/failure indicators), or any dependencies (e.g., requiring prior server configuration). For a testing tool with no structured output documentation, the description should provide more context to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with the single parameter 'testType' fully documented in the schema (including enum values and descriptions). The tool description adds no parameter-specific information beyond what the schema provides. According to the rules, when schema_description_coverage is high (>80%), the baseline score is 3 even with no param info in the description, which applies here.

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: to test email server connections. It uses a specific verb ('测试' meaning 'test') and resource ('邮箱服务器连接' meaning 'email server connection'), making the intent unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'configure_email_server' or 'setup_email_account', which might involve similar server interactions but for different purposes.

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 (e.g., needing a configured server first), exclusions, or comparisons to siblings like 'configure_email_server' (for setup) or 'send_email' (for actual operations). Without such context, an agent might struggle to select this tool appropriately in scenarios involving email server interactions.

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/TimeCyber/email-mcp'

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