Skip to main content
Glama

list_labels

Retrieve all Gmail labels to organize your inbox and manage email categorization within the GMail Manager MCP server.

Instructions

List all Gmail labels

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Tool handler for 'list_labels': calls GmailService.listLabels(), categorizes labels into system and user, and formats a response text.
    case "list_labels": { const labels = await gmailService.listLabels(); const system = labels.filter(l => l.type === 'system'); const user = labels.filter(l => l.type === 'user'); return { content: [{ type: "text", text: labels.length ? `System Labels (${system.length}):\n${system.map(l => ` - ${l.name} (${l.id})`).join('\n')}\n\nUser Labels (${user.length}):\n${user.map(l => ` - ${l.name} (${l.id})`).join('\n')}` : "No labels found." }] }; }
  • Zod input schema for list_labels tool (no parameters).
    list_labels: z.object({}),
  • src/tools.ts:50-55 (registration)
    Registers all tools including list_labels by generating JSON schemas from Zod definitions and descriptions.
    export const getToolDefinitions = () => Object.entries(schemas).map(([name, schema]) => ({ name, description: toolDescriptions[name], inputSchema: zodToJsonSchema(schema) }));
  • GmailService method that fetches and returns all Gmail labels using Google Gmail API.
    async listLabels(): Promise<Label[]> { const { data } = await this.gmail.users.labels.list({ userId: 'me' }); return (data.labels || []) as Label[]; }

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/muammar-yacoob/GMail-Manager-MCP'

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