Skip to main content
Glama
MadLlama25

Fastmail MCP Server

by MadLlama25

test_bulk_operations

Test recent emails by safely marking them as read or unread. Use dry run to preview changes before applying.

Instructions

Test bulk operations by finding recent emails and performing safe operations (mark read/unread)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dryRunNoIf true, only shows what would be done without making changes (default: true)
limitNoNumber of emails to test with (default: 3, max: 10)

Implementation Reference

  • src/index.ts:966-984 (registration)
    Tool registration: 'test_bulk_operations' declared in the ListToolsRequestSchema handler with its description and input schema (dryRun, limit).
    {
      name: 'test_bulk_operations',
      description: 'Test bulk operations by finding recent emails and performing safe operations (mark read/unread)',
      inputSchema: {
        type: 'object',
        properties: {
          dryRun: {
            type: 'boolean',
            description: 'If true, only shows what would be done without making changes (default: true)',
            default: true,
          },
          limit: {
            type: 'number',
            description: 'Number of emails to test with (default: 3, max: 10)',
            default: 3,
          },
        },
      },
    },
  • Tool handler: 'test_bulk_operations' case in the CallToolRequestSchema switch. Fetches recent emails, performs test bulk operations (mark read/unread) with dry-run support.
    case 'test_bulk_operations': {
      const { dryRun = true, limit = 3 } = args as any;
      const client = initializeClient();
      
      // Get some recent emails to test with
      const testLimit = Math.min(Math.max(limit, 1), 10);
      const emails = await client.getRecentEmails(testLimit, 'inbox');
      
      if (emails.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: 'No emails found for bulk operation testing. Try sending yourself a test email first.',
            },
          ],
        };
      }
      
      const emailIds = emails.slice(0, testLimit).map(email => email.id);
      const operations = [
        {
          name: 'bulk_mark_read',
          description: `Mark ${emailIds.length} emails as read`,
          parameters: { emailIds, read: true }
        },
        {
          name: 'bulk_mark_read (undo)',
          description: `Mark ${emailIds.length} emails as unread (undo previous)`,
          parameters: { emailIds, read: false }
        }
      ];
      
      const results = {
        testEmails: emails.map(email => ({
          id: email.id,
          subject: email.subject,
          from: email.from?.[0]?.email || 'unknown',
          receivedAt: email.receivedAt
        })),
        operations: [] as any[]
      };
      
      if (dryRun) {
        results.operations = operations.map(op => ({
          ...op,
          status: 'DRY RUN - Would execute but not actually performed',
          executed: false
        }));
        
        return {
          content: [
            {
              type: 'text',
              text: `BULK OPERATIONS TEST (DRY RUN)\n\n${JSON.stringify(results, null, 2)}\n\nTo actually execute the test, set dryRun: false`,
            },
          ],
        };
      } else {
        // Execute the test operations
        for (const operation of operations) {
          try {
            await client.bulkMarkRead(operation.parameters.emailIds, operation.parameters.read);
            results.operations.push({
              ...operation,
              status: 'SUCCESS',
              executed: true,
              timestamp: new Date().toISOString()
            });
            
            // Small delay between operations
            await new Promise(resolve => setTimeout(resolve, 500));
          } catch (error) {
            results.operations.push({
              ...operation,
              status: 'FAILED',
              executed: false,
              error: error instanceof Error ? error.message : String(error),
              timestamp: new Date().toISOString()
            });
          }
        }
        
        return {
          content: [
            {
              type: 'text',
              text: `BULK OPERATIONS TEST (EXECUTED)\n\n${JSON.stringify(results, null, 2)}`,
            },
          ],
        };
      }
    }
Behavior2/5

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

No annotations provided. The description says 'safe operations' but does not clarify that when dryRun is false, actions actually modify emails. This omission is critical for a test tool.

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?

A single, efficient sentence that conveys the core purpose. No wasted words.

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?

With no output schema and no annotations, the description is too brief. It lacks details about what 'test' means, success/error behavior, or how it differs from sibling bulk tools.

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?

Schema coverage is 100%, so descriptions for dryRun and limit are present. The tool description adds context about finding recent emails and safe operations, but does not add new meaning beyond the schema.

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 is for testing bulk operations by finding recent emails and performing safe operations like mark read/unread. It distinguishes from actual bulk tools by the 'test' intent, though it doesn't explicitly name a sibling.

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?

Implies use for testing before actual bulk operations, but does not explicitly state when to use this vs sibling tools like bulk_mark_read or bulk_add_labels. No when-not or alternatives mentioned.

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/MadLlama25/fastmail-mcp'

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