Skip to main content
Glama

get_attachment

Retrieve email attachments from Gmail messages by specifying the message ID and attachment ID to access files directly from your inbox.

Instructions

Get a message attachment

Input Schema

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

Implementation Reference

  • The handler function for the 'get_attachment' tool. It uses the shared handleTool to authenticate and call the Gmail API's users.messages.attachments.get method with the provided messageId and attachment id, then formats the response.
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.messages.attachments.get({ userId: 'me', messageId: params.messageId, id: params.id })
          return formatResponse(data)
        })
      }
    )
  • Zod schema defining the input parameters for the get_attachment tool: messageId (string) and id (string).
      messageId: z.string().describe("ID of the message containing the attachment"),
      id: z.string().describe("The ID of the attachment"),
    },
  • src/index.ts:688-700 (registration)
    Registration of the 'get_attachment' tool on the MCP server, including name, description, input schema, and handler function.
    server.tool("get_attachment",
      "Get a message attachment",
      {
        messageId: z.string().describe("ID of the message containing the attachment"),
        id: z.string().describe("The ID of the attachment"),
      },
      async (params) => {
        return handleTool(config, async (gmail: gmail_v1.Gmail) => {
          const { data } = await gmail.users.messages.attachments.get({ userId: 'me', messageId: params.messageId, id: params.id })
          return formatResponse(data)
        })
      }
    )
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 states the tool 'gets' an attachment, implying a read-only operation, but doesn't specify if this requires authentication, returns binary data or metadata, has rate limits, or handles errors. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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. It's front-loaded with the core purpose and uses minimal words to convey the essential action, making it easy for an agent to parse quickly.

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 no annotations, no output schema, and a simple input schema, the description is incomplete. It doesn't cover what the tool returns (e.g., attachment content or metadata), error conditions, or usage context. For a retrieval tool with 2 required parameters, this minimal description leaves the agent under-informed about key behavioral aspects.

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 both parameters ('messageId' and 'id') clearly documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., it doesn't explain format examples or relationships between parameters). Baseline 3 is appropriate when the schema does the heavy lifting.

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 'Get a message attachment' clearly states the action (get) and resource (message attachment). It distinguishes this tool from siblings like 'get_message' or 'get_draft' by specifying it retrieves attachments rather than messages themselves. However, it doesn't explicitly contrast with potential attachment-related siblings (none exist in the list), so it's not a perfect 5.

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 a message ID first from 'get_message'), nor does it differentiate from other retrieval tools like 'get_message' that might include attachments. The agent must infer usage from the tool name and parameters 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