Skip to main content
Glama

get_attachment

Retrieve email attachments from Gmail messages using message and attachment IDs to access files sent in emails.

Instructions

Get a message attachment

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYesID of the message containing the attachment
idYesThe ID of the attachment

Implementation Reference

  • Shared helper function handleTool that manages OAuth2 authentication and Gmail client creation for all tools, including get_attachment.
        const oauth2Client = new OAuth2Client({
          clientId: credentials?.clientId,
          clientSecret: credentials?.clientSecret,
          redirectUri: `http://localhost:${AUTH_SERVER_PORT}/oauth2callback`
        })
    
        if (credentials?.refreshToken) oauth2Client.setCredentials({ refresh_token: credentials.refreshToken })
    
        return oauth2Client
      } catch (error: any) {
        return null
      }
    }
    
    export const launchAuthServer = async (oauth2Client: OAuth2Client) => new Promise((resolve, reject) => {
      const server = http.createServer()

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

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