Skip to main content
Glama
attachment-get.ts1.09 kB
import {z} from 'zod'; import type {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; import type {Config} from './types.js'; import {makeGmailApiCall} from '../utils/gmail-api.js'; import {jsonResult} from '../utils/response.js'; const inputSchema = { messageId: z.string().describe('The ID of the message containing the attachment'), attachmentId: z.string().describe('The ID of the attachment'), }; const outputSchema = z.object({ size: z.number(), data: z.string().describe('Base64url-encoded attachment data'), }); export function registerAttachmentGet(server: McpServer, config: Config): void { server.registerTool( 'gmail_attachment_get', { title: 'Get attachment', description: 'Get a message attachment. Returns base64url-encoded data.', inputSchema, outputSchema, annotations: { readOnlyHint: true, }, }, async ({messageId, attachmentId}) => { const result = await makeGmailApiCall('GET', `/users/me/messages/${messageId}/attachments/${attachmentId}`, config.token); return jsonResult(outputSchema.parse(result)); }, ); }

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

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