Skip to main content
Glama
0x8687

Meme MCP Server

by 0x8687

get-threads

Retrieve email threads from Gmail using a search query and specify the maximum number of results. Integrates with the Meme MCP Server for meme generation workflows.

Instructions

Get email threads

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
maxResultsNoMaximum number of threads to retrieve
queryNoGmail search query to filter threads

Implementation Reference

  • The asynchronous handler function that implements the core logic for the 'get-threads' tool. It executes 'GMAIL_GET_THREADS' action via toolset, processes the threads into a formatted list, and returns a text response.
    }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_THREADS", entityId: userAddress, params: args }); if (result.successful) { const threads = result.data?.response_data as any; const threadList = threads.threads?.map((thread: any) => `• Thread ${thread.id} (${thread.snippet})` ).join('\n') || 'No threads found'; return { content: [{ type: "text", text: `🧵 Threads retrieved successfully!\n\n${threadList}\n\nTotal: ${threads.threads?.length || 0} threads` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get threads: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting threads:', error); return { content: [{ type: "text", text: `Error getting threads: ${error instanceof Error ? error.message : String(error)}` }], }; } });
  • Input schema defined using Zod for validating parameters: optional maxResults (number) and query (string).
    maxResults: z.number().optional().describe("Maximum number of threads to retrieve"), query: z.string().optional().describe("Gmail search query to filter threads"),
  • src/tools.ts:444-486 (registration)
    Registration of the 'get-threads' tool using server.tool(), including description, input schema, and inline handler function.
    server.tool("get-threads", "Get email threads", { maxResults: z.number().optional().describe("Maximum number of threads to retrieve"), query: z.string().optional().describe("Gmail search query to filter threads"), }, async (args, extra) => { try { const userAddress = "default-user"; const result = await toolset.executeAction({ action: "GMAIL_GET_THREADS", entityId: userAddress, params: args }); if (result.successful) { const threads = result.data?.response_data as any; const threadList = threads.threads?.map((thread: any) => `• Thread ${thread.id} (${thread.snippet})` ).join('\n') || 'No threads found'; return { content: [{ type: "text", text: `🧵 Threads retrieved successfully!\n\n${threadList}\n\nTotal: ${threads.threads?.length || 0} threads` }], }; } else { return { content: [{ type: "text", text: `❌ Failed to get threads: ${result.error || 'Unknown error'}` }], }; } } catch (error) { console.error('Error getting threads:', error); return { content: [{ type: "text", text: `Error getting threads: ${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