Skip to main content
Glama

create_label

Define a new Gmail label, configuring its name, message visibility, label visibility, and color.

Instructions

Create a new label

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe display name of the label
messageListVisibilityNoThe visibility of messages with this label in the message list
labelListVisibilityNoThe visibility of the label in the label list
colorNoThe color settings for the label

Implementation Reference

  • src/index.ts:436-453 (registration)
    Registration of the 'create_label' tool on the MCP server via server.tool(). Includes both the schema definition (name, messageListVisibility, labelListVisibility, color params) and the handler logic.
    server.tool("create_label",
      "Create a new label",
      {
        name: z.string().describe("The display name of the label"),
        messageListVisibility: z.enum(['show', 'hide']).optional().describe("The visibility of messages with this label in the message list"),
        labelListVisibility: z.enum(['labelShow', 'labelShowIfUnread', 'labelHide']).optional().describe("The visibility of the label in the label list"),
        color: z.object({
          textColor: z.string().describe("The text color of the label as hex string"),
          backgroundColor: z.string().describe("The background color of the label as hex string")
        }).optional().describe("The color settings for the label")
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.labels.create({ userId: 'me', requestBody: params })
          return formatResponse(data)
        })
      }
    )
  • The handler function for create_label. It uses handleTool to authenticate, then calls the Gmail API users.labels.create with the params as the requestBody, and formats the response.
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.labels.create({ userId: 'me', requestBody: params })
          return formatResponse(data)
        })
      }
    )
  • Zod schema definitions for the create_label tool's input parameters: name (required string), messageListVisibility (optional enum), labelListVisibility (optional enum), and color (optional object with textColor and backgroundColor hex strings).
    {
      name: z.string().describe("The display name of the label"),
      messageListVisibility: z.enum(['show', 'hide']).optional().describe("The visibility of messages with this label in the message list"),
      labelListVisibility: z.enum(['labelShow', 'labelShowIfUnread', 'labelHide']).optional().describe("The visibility of the label in the label list"),
      color: z.object({
        textColor: z.string().describe("The text color of the label as hex string"),
        backgroundColor: z.string().describe("The background color of the label as hex string")
      }).optional().describe("The color settings for the label")
    },
Behavior2/5

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

No annotations provided. Description does not disclose behavior such as what happens if label name already exists, or any limitations on label creation.

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

Conciseness3/5

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

Description is very short (4 words), which is concise but lacks necessary details. Could add a sentence about behavior without being verbose.

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 no output schema and complex behavioral aspects (visibility, color, naming conflicts), the description is incomplete for an agent to confidently use the tool.

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?

Input schema covers 100% of parameters with descriptions. The tool description adds no additional meaning beyond the schema, achieving baseline 3.

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

Purpose4/5

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

The description 'Create a new label' clearly states the action and resource. It distinguishes from siblings like delete_label or patch_label, but does not provide context that it's for Gmail labels.

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 on when to use this tool vs alternatives like update_label or patch_label. No mention of prerequisites or conditions.

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/shinzo-labs/gmail-mcp'

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