Skip to main content
Glama
erickva

Google Calendar - No deletion

by erickva

modify_email

Adjust email labels such as archive, trash, and read/unread status. Manage email organization by adding or removing labels using a specified email ID.

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 modifies an email's labels by adding or removing specified labels using the Gmail API.
    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,
        };
      }
    }
  • Defines the input schema for the modify_email tool, specifying parameters like id (required), addLabels, and removeLabels.
    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:128-151 (registration)
    Registers the modify_email tool in the list of available tools returned by ListToolsRequest.
    {
      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:236-237 (registration)
    Registers the handler for the modify_email tool in the CallToolRequest switch statement.
    case 'modify_email':
      return await this.handleModifyEmail(request.params.arguments);

Tool Definition Quality

Score is being calculated. Check back soon.

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/erickva/google-workspace-mcp-server-no-calendar-deletetion'

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