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)}` 
                }],
            };
        }
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Get email threads' implies a read-only operation but doesn't specify whether it requires authentication, how it handles pagination, what the return format is, or any rate limits. For a tool with no annotation coverage, this leaves critical behavioral traits undocumented.

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 extremely concise at just three words ('Get email threads'), with no wasted words or unnecessary elaboration. It's front-loaded and efficiently communicates the core function, making it easy to parse quickly. This is an example of optimal brevity for a simple tool.

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 the complexity of email thread retrieval, no annotations, and no output schema, the description is incomplete. It doesn't explain what 'threads' entail (e.g., grouped emails), how results are returned, or any authentication requirements. For a tool with rich sibling tools and no structured support, more context is needed to guide effective use.

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?

The input schema has 100% description coverage, with clear documentation for both parameters ('maxResults' and 'query'). The description adds no parameter-specific information beyond what's in the schema, so it doesn't enhance semantic understanding. According to the rules, baseline is 3 when schema coverage is high (>80%) and no param info is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get email threads' clearly states the verb ('Get') and resource ('email threads'), making the basic purpose understandable. However, it doesn't differentiate this tool from sibling tools like 'get-emails' or 'search-emails', leaving ambiguity about when to use each. The description is functional but lacks specificity about scope or differentiation.

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 like 'get-emails' or 'search-emails'. It doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name alone. This lack of explicit guidance reduces effectiveness in tool selection.

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

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