Skip to main content
Glama

remove_delegate

Revoke email delegate access by removing a specified delegate’s email, ensuring secure and direct control over your Gmail account.

Instructions

Removes the specified delegate

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
delegateEmailYesEmail address of delegate to remove

Implementation Reference

  • src/index.ts:975-986 (registration)
    Registration of the 'remove_delegate' tool, including schema definition and inline handler function that deletes a Gmail delegate using the API.
    server.tool("remove_delegate",
      "Removes the specified delegate",
      {
        delegateEmail: z.string().describe("Email address of delegate to remove")
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.settings.delegates.delete({ userId: 'me', delegateEmail: params.delegateEmail })
          return formatResponse(data)
        })
      }
    )
  • Handler implementation for 'remove_delegate' tool. Authenticates via handleTool and calls Gmail API to remove the delegate by email.
    async (params) => {
      return handleTool(config, async (gmail: gmail_v1.Gmail) => {
        const { data } = await gmail.users.settings.delegates.delete({ userId: 'me', delegateEmail: params.delegateEmail })
        return formatResponse(data)
      })
    }
  • Zod schema defining the input parameters for the 'remove_delegate' tool: delegateEmail (string).
    {
      delegateEmail: z.string().describe("Email address of delegate to remove")
    },
  • Shared helper function handleTool used by all Gmail tools, including remove_delegate, to handle OAuth authentication, client creation, API call execution, and error handling.
    const handleTool = async (queryConfig: Record<string, any> | undefined, apiCall: (gmail: gmail_v1.Gmail) => Promise<any>) => {
      try {
        const oauth2Client = queryConfig ? createOAuth2Client(queryConfig) : defaultOAuth2Client
        if (!oauth2Client) throw new Error('OAuth2 client could not be created, please check your credentials')
    
        const credentialsAreValid = await validateCredentials(oauth2Client)
        if (!credentialsAreValid) throw new Error('OAuth2 credentials are invalid, please re-authenticate')
    
        const gmailClient = queryConfig ? google.gmail({ version: 'v1', auth: oauth2Client }) : defaultGmailClient
        if (!gmailClient) throw new Error('Gmail client could not be created, please check your credentials')
    
        const result = await apiCall(gmailClient)
        return result
      } catch (error: any) {
        // Check for specific authentication errors
        if (
          error.message?.includes("invalid_grant") ||
          error.message?.includes("refresh_token") ||
          error.message?.includes("invalid_client") ||
          error.message?.includes("unauthorized_client") ||
          error.code === 401 ||
          error.code === 403
        ) {
          return formatResponse({
            error: `Authentication failed: ${error.message}. Please re-authenticate by running: npx @shinzolabs/gmail-mcp auth`,
          });
        }
    
        return formatResponse({ error: `Tool execution failed: ${error.message}` });
      }
    }
  • Helper function to format API responses into MCP content structure, used in remove_delegate handler.
    const formatResponse = (response: any) => ({ content: [{ type: "text", text: JSON.stringify(response) }] })
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. 'Removes' implies a destructive mutation, but the description doesn't disclose behavioral traits like whether removal is permanent/reversible, what permissions are required, if it affects associated data, or what happens on success/failure. For a destructive tool with zero annotation coverage, this is a significant gap in transparency.

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—every word earns its place. It's front-loaded with the core action and target, making it immediately scannable. No redundant information or fluff is present, achieving optimal conciseness for such a simple tool.

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 this is a destructive mutation tool with no annotations and no output schema, the description is incomplete. It lacks crucial context: what system the delegate operates in (inferred as email from sibling tools), what 'removes' entails behaviorally, error conditions, or return values. For a tool that permanently modifies data, this level of brevity is inadequate.

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%, with the parameter 'delegateEmail' clearly documented in the schema. The description adds no additional meaning beyond specifying 'the specified delegate'—it doesn't clarify format constraints, domain requirements, or validation rules. With high schema coverage, the baseline is 3, as the description doesn't compensate but doesn't detract either.

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 ('removes') and target ('the specified delegate'), making the purpose immediately understandable. It distinguishes from sibling tools like 'add_delegate' and 'list_delegates' by specifying removal rather than addition or listing. However, it doesn't explicitly mention what system or context the delegate belongs to (e.g., email, calendar), which prevents a perfect score.

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., delegate must exist), when-not-to-use scenarios, or direct alternatives like 'delete_delegate' if it existed. The presence of sibling tools like 'add_delegate' and 'list_delegates' suggests a delegate management system, but no explicit comparison is made.

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

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