Skip to main content
Glama

get_forwarding_address

Retrieve a specific email forwarding address configured in Gmail to verify or manage forwarding settings.

Instructions

Gets the specified forwarding address

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forwardingEmailYesThe forwarding address to be retrieved

Implementation Reference

  • src/index.ts:1089-1100 (registration)
    Registration of the 'get_forwarding_address' tool including schema definition and inline handler function that calls the Gmail API to get the forwarding address.
    server.tool("get_forwarding_address",
      "Gets the specified forwarding address",
      {
        forwardingEmail: z.string().describe("The forwarding address to be retrieved")
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.settings.forwardingAddresses.get({ userId: 'me', forwardingEmail: params.forwardingEmail })
          return formatResponse(data)
        })
      }
    )
  • Inline handler implementation for get_forwarding_address tool. Uses handleTool helper to authenticate and call Gmail API's users.settings.forwardingAddresses.get method.
    async (params) => {
      return handleTool(config, async (gmail: gmail_v1.Gmail) => {
        const { data } = await gmail.users.settings.forwardingAddresses.get({ userId: 'me', forwardingEmail: params.forwardingEmail })
        return formatResponse(data)
      })
    }
  • Input schema for get_forwarding_address tool requiring a single 'forwardingEmail' string parameter.
    {
      forwardingEmail: z.string().describe("The forwarding address to be retrieved")
    },
  • General helper function used by all tools, including get_forwarding_address, to handle OAuth2 authentication and execute the Gmail API call.
    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) {
        return `Tool execution failed: ${error.message}`
      }
    }
  • Helper function to format API responses into MCP-compatible content structure, used by get_forwarding_address 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 the full burden of behavioral disclosure. It only states the action ('Gets') without details on permissions required, error handling, rate limits, or what the output contains (e.g., metadata, status). For a read operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves in practice.

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 no wasted words. It's front-loaded with the core action and resource, making it easy to scan. Every part of the sentence contributes directly to stating the tool's purpose, adhering to best practices for conciseness in tool definitions.

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 lack of annotations and output schema, the description is incomplete for a tool that likely returns detailed data. It doesn't explain what information is retrieved (e.g., forwarding rules, verification status) or handle edge cases. For a read operation with no structured output documentation, more context is needed to guide the agent 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?

The input schema has 100% description coverage, with the parameter 'forwardingEmail' clearly documented as 'The forwarding address to be retrieved'. The description adds no additional meaning beyond this, such as format examples or constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't compensate but also doesn't detract.

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

Purpose3/5

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

The description states the action ('Gets') and resource ('the specified forwarding address'), but it's vague about what 'gets' entails—retrieving metadata, configuration, or status? It doesn't differentiate from sibling tools like 'list_forwarding_addresses' or 'get_auto_forwarding', which handle related resources. The purpose is clear at a basic level but lacks specificity for precise tool selection.

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 is provided on when to use this tool versus alternatives. Sibling tools include 'list_forwarding_addresses' for listing all addresses and 'get_auto_forwarding' for auto-forwarding settings, but the description doesn't mention these or specify use cases like retrieving details for a single known address. Without such context, the agent must infer usage from the tool name 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