Skip to main content
Glama

modify_message

Add or remove labels from Gmail messages to organize your inbox by categorizing emails with specific tags for better email management.

Instructions

Modify the labels on a message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe ID of the message to modify
addLabelIdsNoA list of label IDs to add to the message
removeLabelIdsNoA list of label IDs to remove from the message

Implementation Reference

  • src/index.ts:611-624 (registration)
    Registration of the 'modify_message' tool, including description, input schema, and handler function.
    server.tool("modify_message",
      "Modify the labels on a message",
      {
        id: z.string().describe("The ID of the message to modify"),
        addLabelIds: z.array(z.string()).optional().describe("A list of label IDs to add to the message"),
        removeLabelIds: z.array(z.string()).optional().describe("A list of label IDs to remove from the message")
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.messages.modify({ userId: 'me', id: params.id, requestBody: { addLabelIds: params.addLabelIds, removeLabelIds: params.removeLabelIds } })
          return formatResponse(data)
        })
      }
    )
  • Zod schema defining input parameters for the modify_message tool: message ID and optional label IDs to add/remove.
    {
      id: z.string().describe("The ID of the message to modify"),
      addLabelIds: z.array(z.string()).optional().describe("A list of label IDs to add to the message"),
      removeLabelIds: z.array(z.string()).optional().describe("A list of label IDs to remove from the message")
    },
  • Handler implementation that uses handleTool to authenticate and call Gmail API's users.messages.modify to update message labels.
    async (params) => {
      return handleTool(config, async (gmail: gmail_v1.Gmail) => {
        const { data } = await gmail.users.messages.modify({ userId: 'me', id: params.id, requestBody: { addLabelIds: params.addLabelIds, removeLabelIds: params.removeLabelIds } })
        return formatResponse(data)
      })
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states 'modify' implying a mutation, but doesn't disclose behavioral traits like required permissions, whether changes are reversible, rate limits, or what happens on success/failure. This is inadequate for a mutation tool with zero annotation coverage.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, clearly stating the core functionality without unnecessary elaboration.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects like permissions, side effects, or response format, leaving significant gaps for an AI agent to understand how to use this tool effectively.

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 description coverage is 100%, so the schema already documents all parameters (id, addLabelIds, removeLabelIds). The description adds no additional meaning beyond what's in the schema, such as explaining label ID formats or interaction between add/remove operations. Baseline 3 is appropriate when schema does the heavy lifting.

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 clearly states the action ('modify') and target resource ('labels on a message'), making the purpose understandable. However, it doesn't differentiate from sibling tools like 'batch_modify_messages' or 'update_label', which could cause confusion about when to use this specific tool versus alternatives.

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?

The description provides no guidance on when to use this tool versus alternatives like 'batch_modify_messages' or 'update_label', nor does it mention prerequisites or context for usage. The agent must infer usage from the tool name and parameters alone.

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

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