Skip to main content
Glama

read_email

Retrieve complete email content from your Gmail inbox by providing the message ID, enabling you to access and review full messages through Claude Desktop.

Instructions

Read the full content of an email

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageIdYesEmail message ID

Implementation Reference

  • The handler function in handleToolCall that processes the read_email tool call, validates input, fetches the email via GmailService, and formats the response.
    case "read_email": { const v = validated as z.infer<typeof schemas.read_email>; const email = await gmailService.readEmail(v.messageId); return { content: [{ type: "text", text: `Subject: ${email.subject}\nFrom: ${email.from}\nTo: ${email.to}\nDate: ${email.date}\nThread ID: ${email.threadId}\nGmail URL: ${gmailService.getEmailUrl(v.messageId)}\n\nContent:\n${email.body}` }] }; }
  • Core GmailService method that fetches and parses the full email details using the Gmail API.
    async readEmail(messageId: string): Promise<EmailDetails> { const { data } = await this.gmail.users.messages.get({ userId: 'me', id: messageId, format: 'full' }); const h = data.payload?.headers || []; const findHeader = (name: string) => h.find(x => x.name?.toLowerCase() === name.toLowerCase())?.value || ''; return { id: messageId, threadId: data.threadId || '', subject: findHeader('subject'), from: findHeader('from'), to: findHeader('to'), date: findHeader('date'), body: this.extractBody(data.payload) }; }
  • Zod schema defining the input for the read_email tool: requires a messageId string.
    read_email: z.object({ messageId: z.string().describe("Email message ID") }),
  • src/tools.ts:50-55 (registration)
    Function that generates tool definitions for all tools including read_email, used for MCP registration.
    export const getToolDefinitions = () => Object.entries(schemas).map(([name, schema]) => ({ name, description: toolDescriptions[name], inputSchema: zodToJsonSchema(schema) }));

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/muammar-yacoob/GMail-Manager-MCP'

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