Skip to main content
Glama
owen-nash

Fastmail MCP Server

by owen-nash

test_bulk_operations

Find recent emails and perform safe bulk mark-as-read or unread operations. 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:969-987 (registration)
    Tool registration in ListToolsRequestSchema handler for 'test_bulk_operations' with inputSchema defining dryRun (boolean, default true) and limit (number, default 3, max 10)
    {
      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,
          },
        },
      },
    },
  • Handler case 'test_bulk_operations' in CallToolRequestSchema. Fetches recent emails, tests bulk_mark_read (mark as read then undo/unread). Supports dryRun mode (default true). Executes real bulk operations when dryRun=false, with error handling per operation.
    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)}`,
            },
          ],
        };
      }
    }
  • Operations array defined within the handler containing two test operations: bulk_mark_read (mark as read) and bulk_mark_read undo (mark as unread).
    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 }
      }
    ];
Behavior3/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 'safe operations (mark read/unread)' but does not disclose what happens when dryRun is false, whether changes are permanent, or any limits beyond the schema. More detail on the test's actual effect would improve 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?

Single sentence, front-loaded with key action, no redundant words. Efficient and 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?

No output schema exists, so the description should explain the test's output (e.g., what is returned). It does not mention return values, success/failure indicators, or how results relate to sibling bulk tools. This is a significant gap for a test tool.

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% and both parameters (dryRun, limit) are well described in the schema. The description adds no additional meaning beyond the schema, meeting the baseline expectation.

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?

The description clearly states the tool tests bulk operations by finding recent emails and performing safe operations like mark read/unread. It distinguishes itself from sibling bulk tools (e.g., bulk_mark_read, bulk_delete) by being a test tool, not the actual operation.

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?

The description implies use for testing, but lacks explicit guidance on when to use versus alternatives like bulk_mark_read or when not to use. No exclusions or prerequisites are mentioned, leaving the agent to infer context.

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

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