Skip to main content
Glama

create_label

Create a new Gmail label by providing a label name. This tool adds the label to your Gmail account for organizing and categorizing emails.

Instructions

Create a new Gmail label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesLabel name

Implementation Reference

  • The actual Gmail API call to create a label via the Google Gmail API. Uses gmail.users.labels.create with messageListVisibility:'show' and labelListVisibility:'labelShow'.
    async createLabel(name: string): Promise<Label> {
        const { data } = await this.gmail.users.labels.create({
            userId: 'me',
            requestBody: { name, messageListVisibility: 'show', labelListVisibility: 'labelShow' }
        });
        return data as Label;
    }
  • The case handler in handleToolCall() that validates input and dispatches to gmailService.createLabel(), then formats the success response with label name and ID.
    case "create_label": {
        const v = validated as z.infer<typeof schemas.create_label>;
        const label = await gmailService.createLabel(v.name);
        return { content: [{ type: "text", text: `Label created successfully:\nName: ${label.name}\nID: ${label.id}` }] };
    }
  • Zod schema definition for create_label tool. Requires a single string parameter 'name' for the label name.
    create_label: z.object({ name: z.string().describe("Label name") }),
  • src/tools.ts:41-41 (registration)
    Tool description registration for create_label used in getToolDefinitions().
    create_label: "Create a new Gmail label",
  • src/lib.ts:48-48 (registration)
    MCP server registration: the ListToolsRequestSchema handler calls getToolDefinitions() which includes create_label, and the CallToolRequestSchema handler dispatches to handleToolCall().
    server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: getToolDefinitions() }));
Behavior2/5

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

No annotations are present, so the description must carry the full burden. It only states 'create' (a mutation) but lacks details on authentication, idempotency, error handling (e.g., duplicate label names), or side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with no wasted words, but the brevity sacrifices important context that could be added without losing conciseness.

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 simplicity of the tool (one param, no output schema), the description should at least mention what happens on success (e.g., returns the label object) or prerequisites (authenticated user). It does not, leaving gaps for the agent.

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?

Schema coverage is 100% with one parameter 'name' described as 'Label name'. The description adds no extra meaning beyond the schema, so a baseline of 3 is appropriate.

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

Purpose5/5

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

The description 'Create a new Gmail label' clearly states the action (create) and the resource (Gmail label), which distinguishes it from sibling tools like delete_label, list_labels, and apply_label.

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?

No guidance is provided on when to use this tool vs alternatives. For instance, no mention of whether it should be used before applying a label or how it differs from creating labels via other means.

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

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