Skip to main content
Glama
0x8687

Meme MCP Server

by 0x8687

get-emails

Retrieve emails from an inbox based on Gmail search queries or label IDs. Specify maximum results to fetch filtered messages efficiently via the MCP server.

Instructions

Get emails from inbox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelIdsNoArray of label IDs to filter by
maxResultsNoMaximum number of emails to retrieve (default: 10)
queryNoGmail search query to filter emails

Implementation Reference

  • The handler function for the 'get-emails' tool. It uses the Composio toolset to execute the 'GMAIL_GET_EMAILS' action with the provided parameters, processes the response to extract email snippets and IDs, formats them into a list, and returns a formatted text response or error message.
    }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_EMAILS", entityId: userAddress, params: args }); if (result.successful) { const emails = result.data?.response_data as any; const emailList = emails.messages?.map((email: any) => `• ${email.snippet} (${email.id})` ).join('\n') || 'No emails found'; return { content: [{ type: "text", text: `📧 Emails retrieved successfully!\n\n${emailList}\n\nTotal: ${emails.messages?.length || 0} emails` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get emails: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting emails:', error); return { content: [{ type: "text", text: `Error getting emails: ${error instanceof Error ? error.message : String(error)}` }], }; } });
  • The registration call including the input schema for 'get-emails' tool, defining optional parameters maxResults, query, and labelIds using Zod for validation.
    server.tool("get-emails", "Get emails from inbox", { maxResults: z.number().optional().describe("Maximum number of emails to retrieve (default: 10)"), query: z.string().optional().describe("Gmail search query to filter emails"), labelIds: z.array(z.string()).optional().describe("Array of label IDs to filter by"), }, async (args, extra) => {
  • src/tools.ts:119-162 (registration)
    The full server.tool registration for the 'get-emails' tool within the registerTools function, including name, description, input schema, and inline handler.
    server.tool("get-emails", "Get emails from inbox", { maxResults: z.number().optional().describe("Maximum number of emails to retrieve (default: 10)"), query: z.string().optional().describe("Gmail search query to filter emails"), labelIds: z.array(z.string()).optional().describe("Array of label IDs to filter by"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_EMAILS", entityId: userAddress, params: args }); if (result.successful) { const emails = result.data?.response_data as any; const emailList = emails.messages?.map((email: any) => `• ${email.snippet} (${email.id})` ).join('\n') || 'No emails found'; return { content: [{ type: "text", text: `📧 Emails retrieved successfully!\n\n${emailList}\n\nTotal: ${emails.messages?.length || 0} emails` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get emails: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting emails:', error); return { content: [{ type: "text", text: `Error getting emails: ${error instanceof Error ? error.message : String(error)}` }], }; } });

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/0x8687/mcp-gmail-v1'

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