Skip to main content
Glama
0x8687

Meme MCP Server

by 0x8687

get-labels

Retrieve all Gmail labels to organize and categorize email data for meme creation workflows.

Instructions

Get all Gmail labels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler for the 'get-labels' MCP tool. Retrieves all Gmail labels by executing the Composio 'GMAIL_GET_LABELS' action via VercelAIToolSet, formats the list, and returns a text response.
    server.tool("get-labels", "Get all Gmail labels", {}, async (args, extra) => {
        try {
            const userAddress = "default-user";
            
            const result = await toolset.executeAction({
                action: "GMAIL_GET_LABELS",
                entityId: userAddress,
                params: {}
            });
            
            if (result.successful) {
                const labels = result.data?.response_data as any;
                const labelList = labels.labels?.map((label: any) => 
                    `• ${label.name} (${label.id})`
                ).join('\n') || 'No labels found';
                
                return {
                    content: [{ 
                        type: "text", 
                        text: `🏷️ Labels retrieved successfully!\n\n${labelList}\n\nTotal: ${labels.labels?.length || 0} labels` 
                    }],
                };
            } else {
                return {
                    content: [{ 
                        type: "text", 
                        text: `❌ Failed to get labels: ${result.error || 'Unknown error'}` 
                    }],
                };
            }
        } catch (error) {
            console.error('Error getting labels:', error);
            return {
                content: [{ 
                    type: "text", 
                    text: `Error getting labels: ${error instanceof Error ? error.message : String(error)}` 
                }],
            };
        }
    });
  • src/tools.ts:362-401 (registration)
    Registers the 'get-labels' tool with MCP server using server.tool(), including empty schema {} and inline handler.
    server.tool("get-labels", "Get all Gmail labels", {}, async (args, extra) => {
        try {
            const userAddress = "default-user";
            
            const result = await toolset.executeAction({
                action: "GMAIL_GET_LABELS",
                entityId: userAddress,
                params: {}
            });
            
            if (result.successful) {
                const labels = result.data?.response_data as any;
                const labelList = labels.labels?.map((label: any) => 
                    `• ${label.name} (${label.id})`
                ).join('\n') || 'No labels found';
                
                return {
                    content: [{ 
                        type: "text", 
                        text: `🏷️ Labels retrieved successfully!\n\n${labelList}\n\nTotal: ${labels.labels?.length || 0} labels` 
                    }],
                };
            } else {
                return {
                    content: [{ 
                        type: "text", 
                        text: `❌ Failed to get labels: ${result.error || 'Unknown error'}` 
                    }],
                };
            }
        } catch (error) {
            console.error('Error getting labels:', error);
            return {
                content: [{ 
                    type: "text", 
                    text: `Error getting labels: ${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