Skip to main content
Glama
0x8687

Meme MCP Server

by 0x8687

get-threads

Retrieve email threads from Gmail using search queries to filter and organize messages for AI 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 core handler function for the 'get-threads' tool. It uses the VercelAIToolSet (Composio) to execute the 'GMAIL_GET_THREADS' action with the provided parameters, processes the returned threads into a formatted list, and returns a text response with success or error details.
    }, 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 definition for the 'get-threads' tool using Zod. Defines optional parameters: maxResults (number) and query (string). Provided during tool registration.
    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) => {
  • src/tools.ts:444-486 (registration)
    Registration of the 'get-threads' tool using server.tool() inside the registerTools function. Includes name, description, schema, and inline handler.
    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