Skip to main content
Glama
bcharleson

Instantly MCP Server

list_emails

Retrieve filtered email lists from campaigns or accounts with pagination controls to manage and analyze email data efficiently.

Instructions

List emails with filters and pagination

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
account_idNoFilter by account
campaign_idNoFilter by campaign
limitNoNumber of emails to return (1-100, default: 20)
starting_afterNoID of the last item from previous page for pagination

Implementation Reference

  • Handler function for list_emails tool. Builds query parameters from input args, calls Instantly API endpoint '/emails', adds pagination metadata, and formats response.
    case 'list_emails': {
      console.error('[Instantly MCP] 📧 Executing list_emails...');
    
      const emailsParams: any = {};
    
      // Pagination parameters
      emailsParams.limit = args.limit || 100; // Default to 100 items per page (API maximum)
      if (args.starting_after) emailsParams.starting_after = args.starting_after;
    
      // Filtering parameters
      if (args.campaign_id) emailsParams.campaign_id = args.campaign_id;
      if (args.search) emailsParams.search = args.search;
      if (args.i_status !== undefined) emailsParams.i_status = args.i_status;
      if (args.eaccount) emailsParams.eaccount = args.eaccount;
      if (args.is_unread !== undefined) emailsParams.is_unread = args.is_unread;
      if (args.has_reminder !== undefined) emailsParams.has_reminder = args.has_reminder;
      if (args.mode) emailsParams.mode = args.mode;
      if (args.preview_only !== undefined) emailsParams.preview_only = args.preview_only;
      if (args.sort_order) emailsParams.sort_order = args.sort_order;
      if (args.scheduled_only !== undefined) emailsParams.scheduled_only = args.scheduled_only;
      if (args.assigned_to) emailsParams.assigned_to = args.assigned_to;
      if (args.lead) emailsParams.lead = args.lead;
      if (args.company_domain) emailsParams.company_domain = args.company_domain;
      if (args.marked_as_done !== undefined) emailsParams.marked_as_done = args.marked_as_done;
      if (args.email_type) emailsParams.email_type = args.email_type;
    
      const emailsResult = await makeInstantlyRequest('/emails', { params: emailsParams }, apiKey);
    
      // Add metadata about pagination
      const metadata: any = {
        request_time_ms: Date.now(),
        note: `Retrieved ${emailsResult.items?.length || 0} emails.`
      };
    
      if (emailsResult.next_starting_after) {
        metadata.note += ` More results available. To retrieve additional pages, call this tool again with starting_after parameter set to: ${emailsResult.next_starting_after}`;
      } else {
        metadata.note += ' All results retrieved (no more pages available).';
      }
    
      return createMCPResponse({
        ...emailsResult,
        metadata,
        success: true
      });
    }
  • Tool definition including input schema for list_emails, used for MCP registration and client-side validation.
      name: 'list_emails',
      title: 'List Emails',
      description: 'List emails with pagination. Filter by campaign, account, type, or status.',
      annotations: { readOnlyHint: true },
      inputSchema: {
        type: 'object',
        properties: {
          limit: { type: 'number', description: '1-100, default: 100' },
          starting_after: { type: 'string', description: 'Cursor from pagination' },
          search: { type: 'string', description: 'Search (use "thread:UUID" for threads)' },
          campaign_id: { type: 'string' },
          i_status: { type: 'number', description: 'Interest status' },
          eaccount: { type: 'string', description: 'Sender accounts (comma-separated)' },
          is_unread: { type: 'boolean' },
          has_reminder: { type: 'boolean' },
          mode: { type: 'string', enum: ['emode_focused', 'emode_others', 'emode_all'] },
          preview_only: { type: 'boolean' },
          sort_order: { type: 'string', enum: ['asc', 'desc'] },
          scheduled_only: { type: 'boolean' },
          assigned_to: { type: 'string' },
          lead: { type: 'string', description: 'Lead email' },
          company_domain: { type: 'string' },
          marked_as_done: { type: 'boolean' },
          email_type: { type: 'string', enum: ['received', 'sent', 'manual'] }
        }
      }
    },
  • Zod validation schema for list_emails input parameters.
    export const ListEmailsSchema = z.object({
      campaign_id: z.string().optional(),
      account_id: z.string().optional(),
      limit: z.number().int().min(1).max(100).optional(),
      starting_after: z.string().optional()
    });
  • Validation helper function for list_emails parameters using Zod schema.
    export function validateListEmailsData(args: unknown): z.infer<typeof ListEmailsSchema> {
      return validateWithSchema(ListEmailsSchema, args, 'list_emails');
  • Aggregation of all tool definitions including emailTools (containing list_emails) into TOOLS_DEFINITION array used by MCP server.
    return [
      ...accountTools,
      ...campaignTools,
      ...leadTools,
      ...emailTools,
      ...analyticsTools,
    ];
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 mentions 'filters and pagination', hinting at querying behavior, but fails to disclose critical traits: whether this is a read-only operation, potential rate limits, authentication needs, what happens if filters yield no results, or the format of returned data. For a list tool with no annotation coverage, this is a significant gap.

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 with zero waste. It's front-loaded with the core action ('List emails') and includes key features without redundancy, making it easy to parse quickly.

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 and no output schema, the description is incomplete for a tool with 4 parameters and list functionality. It lacks details on behavioral traits (e.g., safety, limits), return values, or error handling, which are essential for an agent to use it correctly in context with siblings.

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 description coverage is 100%, so the schema fully documents all 4 parameters. The description adds minimal value by mentioning 'filters and pagination', which aligns with parameters like 'account_id' and 'starting_after', but doesn't provide additional context beyond what's in the schema. Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('List emails') and mentions key capabilities ('with filters and pagination'), which distinguishes it from sibling tools like 'get_email' (singular) or 'reply_to_email'. However, it doesn't specify what type of emails (e.g., marketing, transactional) or fully differentiate from other list tools like 'list_campaigns' beyond the resource name.

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 an account), exclusions, or compare it to siblings like 'list_campaigns' or 'get_email', leaving the agent to infer usage from the name alone.

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/bcharleson/Instantly-MCP'

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