Skip to main content
Glama

list_messages

List email messages from a specified inbox or the default inbox. Optionally filter by unread status and limit the number of results.

Instructions

List messages. If inbox_id is omitted, uses the default inbox.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inbox_idNoInbox ID (optional, uses default inbox)
limitNoMax messages to return (default 20)
unreadNoOnly show unread messages

Implementation Reference

  • The MCP tool handler for 'list_messages'. Registers the tool with schema (inbox_id, limit, unread), resolves the default inbox if needed, and makes a GET request to /v1/inboxes/{inbox_id}/messages
    server.tool(
      'list_messages',
      'List messages. If inbox_id is omitted, uses the default inbox.',
      {
        inbox_id: idSchema.optional().describe('Inbox ID (optional, uses default inbox)'),
        limit: z.number().optional().describe('Max messages to return (default 20)'),
        unread: z.boolean().optional().describe('Only show unread messages')
      },
      async ({ inbox_id, limit = 20, unread }) => {
        if (!inbox_id) {
          const inbox = await getOrCreateDefaultInbox();
          if (inbox.error) return { content: [{ type: 'text', text: JSON.stringify(inbox, null, 2) }] };
          inbox_id = inboxId(inbox);
        }
        const params = new URLSearchParams({ limit: String(limit) });
        if (unread) params.set('unread', 'true');
        const result = await api('GET', `/v1/inboxes/${inbox_id}/messages?${params}`);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      }
    );
  • mcp/index.js:201-220 (registration)
    Registration of the 'list_messages' tool via server.tool() with its schema and handler function
    server.tool(
      'list_messages',
      'List messages. If inbox_id is omitted, uses the default inbox.',
      {
        inbox_id: idSchema.optional().describe('Inbox ID (optional, uses default inbox)'),
        limit: z.number().optional().describe('Max messages to return (default 20)'),
        unread: z.boolean().optional().describe('Only show unread messages')
      },
      async ({ inbox_id, limit = 20, unread }) => {
        if (!inbox_id) {
          const inbox = await getOrCreateDefaultInbox();
          if (inbox.error) return { content: [{ type: 'text', text: JSON.stringify(inbox, null, 2) }] };
          inbox_id = inboxId(inbox);
        }
        const params = new URLSearchParams({ limit: String(limit) });
        if (unread) params.set('unread', 'true');
        const result = await api('GET', `/v1/inboxes/${inbox_id}/messages?${params}`);
        return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] };
      }
    );
  • Zod schema for the list_messages tool: inbox_id (optional number/string), limit (optional number, default 20), unread (optional boolean)
    {
      inbox_id: idSchema.optional().describe('Inbox ID (optional, uses default inbox)'),
      limit: z.number().optional().describe('Max messages to return (default 20)'),
      unread: z.boolean().optional().describe('Only show unread messages')
    },
  • Node.js SDK helper method listMessages(inboxId, {limit, offset, unread}) that calls the API
    listMessages(inboxId, { limit = 50, offset = 0, unread } = {}) {
      const params = new URLSearchParams({ limit, offset });
      if (unread) params.set('unread', 'true');
      return this._request('GET', `/v1/inboxes/${inboxId}/messages?${params}`);
    }
  • Python SDK helper method list_messages(inbox_id, limit, offset, unread) that calls the API
    def list_messages(self, inbox_id: int, limit: int = 50, offset: int = 0, unread: bool = False):
        params = urlencode({"limit": limit, "offset": offset, **({"unread": "true"} if unread else {})})
        return self._request("GET", f"/v1/inboxes/{inbox_id}/messages?{params}")
Behavior1/5

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

No annotations provided, and the description does not disclose behavioral traits such as read-only nature, authentication needs, rate limits, or pagination. The agent has no insight beyond the basic operation.

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?

Extremely concise at two sentences with no filler. Each sentence adds value.

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?

Lacking output schema and annotations, the description should explain return values (e.g., list of message objects) or pagination. It is too minimal for a tool with 3 parameters and no other structured context.

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 baseline is 3. The description adds no additional meaning beyond the schema's parameter descriptions, e.g., the default inbox note is already in 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 verb 'List' and resource 'messages', and adds a useful detail about default inbox. It distinguishes from siblings like list_inboxes, but could explicitly differentiate from search_emails.

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?

No guidance on when to use this tool vs alternatives like search_emails or read_email. The description only implies usage but lacks explicit context or exclusions.

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/joansongjr/clawaimail'

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