get_attachment
Retrieve email attachments from Gmail messages using message and attachment IDs to access files sent in emails.
Instructions
Get a message attachment
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"messageId": "<messageId>",
"id": "<id>"
},
"name": "get_attachment"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| messageId | Yes | ID of the message containing the attachment | |
| id | Yes | The ID of the attachment |
Implementation Reference
- src/oauth2.ts:49-65 (helper)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()