Skip to main content
Glama
rishipradeep-think41

Google Workspace MCP Server

modify_email

Manage email labels in Gmail using the Google Workspace MCP Server. Add, remove, archive, trash, or mark emails as read/unread programmatically.

Instructions

Modify email labels (archive, trash, mark read/unread)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
addLabelsNoLabels to add
idYesEmail ID
removeLabelsNoLabels to remove

Implementation Reference

  • The main handler function that executes the modify_email tool logic by calling the Gmail API to add or remove labels from an email.
    private async handleModifyEmail(args: any) {
      try {
        const { id, addLabels = [], removeLabels = [] } = args;
    
        const response = await this.gmail.users.messages.modify({
          userId: "me",
          id,
          requestBody: {
            addLabelIds: addLabels,
            removeLabelIds: removeLabels,
          },
        });
    
        return {
          content: [
            {
              type: "text",
              text: `Email modified successfully. Updated labels for message ID: ${response.data.id}`,
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: `Error modifying email: ${error.message}`,
            },
          ],
          isError: true,
        };
      }
    }
  • src/index.ts:136-159 (registration)
    Registers the 'modify_email' tool in the ListTools response, including its name, description, and input schema.
    {
      name: "modify_email",
      description: "Modify email labels (archive, trash, mark read/unread)",
      inputSchema: {
        type: "object",
        properties: {
          id: {
            type: "string",
            description: "Email ID",
          },
          addLabels: {
            type: "array",
            items: { type: "string" },
            description: "Labels to add",
          },
          removeLabels: {
            type: "array",
            items: { type: "string" },
            description: "Labels to remove",
          },
        },
        required: ["id"],
      },
    },
  • src/index.ts:280-281 (registration)
    Dispatches CallTool requests for 'modify_email' to the handleModifyEmail handler function.
    case "modify_email":
      return await this.handleModifyEmail(request.params.arguments);
  • Defines the input schema for the 'modify_email' tool, specifying required 'id' and optional label arrays.
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string",
          description: "Email ID",
        },
        addLabels: {
          type: "array",
          items: { type: "string" },
          description: "Labels to add",
        },
        removeLabels: {
          type: "array",
          items: { type: "string" },
          description: "Labels to remove",
        },
      },
      required: ["id"],
    },
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions modifying labels but doesn't specify whether this is a destructive operation (e.g., archiving or trashing emails), what permissions are required, rate limits, or the response format. The examples (archive, trash) hint at potential destructive actions, but this isn't clearly stated, leaving gaps in transparency for a mutation tool.

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 that front-loads the core action (modify email labels) with illustrative examples. There's no wasted verbiage, and it directly communicates the tool's function 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?

Given the tool's complexity (a mutation operation with no annotations and no output schema), the description is incomplete. It lacks details on behavioral traits (e.g., destructiveness, auth needs), response expectations, and usage context. While the schema covers parameters well, the overall context for safe and effective use is insufficient.

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 three parameters (id, addLabels, removeLabels) with clear descriptions. The description adds minimal value by implying label types (e.g., archive, trash) but doesn't provide additional syntax, format details, or constraints beyond what the schema offers. This meets the baseline for high schema coverage.

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 tool's purpose as modifying email labels with specific examples (archive, trash, mark read/unread). It distinguishes from siblings like list_emails or send_email by focusing on label modification rather than listing, searching, or sending. However, it doesn't explicitly differentiate from potential label-specific siblings that might not exist in the current set.

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. It doesn't mention prerequisites (e.g., needing an email ID from list_emails), exclusions (e.g., not for modifying email content), or comparisons with other tools like search_emails for finding emails first. Usage is implied but not explicitly stated.

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

Related 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/rishipradeep-think41/gsuite-mcp'

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