get-labels
Retrieve all Gmail labels to organize and categorize email data for meme creation workflows.
Instructions
Get all Gmail labels
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get-labels"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools.ts:362-401 (handler)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)}` }], }; } });