Skip to main content
Glama

get_email_content

Retrieve complete email thread content including body text, attachments, and all messages using a Gmail thread ID for revenue tracking and business management.

Instructions

Get full content of an email thread by ID. Returns complete email body, attachments info, and all messages in the thread.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
threadIdYesGmail thread ID (get this from search_gmail results)

Implementation Reference

  • Handler case for the 'get_email_content' MCP tool. Delegates execution to the shared callAPI function, passing 'getEmailContent' action and input arguments.
    case "get_email_content":
      result = await callAPI("getEmailContent", args);
      break;
  • Input schema definition for the 'get_email_content' tool, specifying required 'threadId' parameter.
    inputSchema: {
      type: "object",
      properties: {
        threadId: {
          type: "string",
          description: "Gmail thread ID (get this from search_gmail results)"
        }
      },
      required: ["threadId"]
    }
  • index.js:351-364 (registration)
    Tool registration object for 'get_email_content' in the ListTools response, including name, description, and input schema.
    {
      name: "get_email_content",
      description: "Get full content of an email thread by ID. Returns complete email body, attachments info, and all messages in the thread.",
      inputSchema: {
        type: "object",
        properties: {
          threadId: {
            type: "string",
            description: "Gmail thread ID (get this from search_gmail results)"
          }
        },
        required: ["threadId"]
      }
    },
  • Shared helper function callAPI that all proxied tools (including get_email_content) use to forward requests to the backend Google Apps Script API at the configured URL.
    async function callAPI(action, data = {}) {
      debugLog('=== API CALL START ===');
      debugLog(`Action: ${action}`);
      debugLog(`Data: ${JSON.stringify(data)}`);
    
      try {
        // Build form-encoded body for POST
        const formData = new URLSearchParams();
        formData.append('action', action);
    
        // Add all data fields to form
        for (const [key, value] of Object.entries(data)) {
          if (value !== undefined && value !== null) {
            formData.append(key, value.toString());
          }
        }
    
        const formString = formData.toString();
        debugLog(`FormData: ${formString}`);
        debugLog(`API_URL: ${API_URL}`);
    
        // Use POST with proper content type
        const response = await fetch(API_URL, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
          },
          body: formString
        });
    
        debugLog(`Response status: ${response.status}`);
        debugLog(`Response ok: ${response.ok}`);
    
        if (!response.ok) {
          debugLog(`Response not OK: ${response.status} ${response.statusText}`);
          throw new Error(`API request failed: ${response.status} ${response.statusText}`);
        }
    
        const text = await response.text();
        debugLog(`Response text length: ${text.length}`);
        debugLog(`Response text: ${text}`);
    
        if (!text) {
          debugLog('ERROR: Empty response from API');
          throw new Error('Empty response from API');
        }
    
        const parsed = JSON.parse(text);
        debugLog(`Parsed successfully: ${JSON.stringify(parsed)}`);
        debugLog('=== API CALL END ===');
        return parsed;
    
      } catch (error) {
        debugLog(`ERROR in callAPI: ${error.message}`);
        debugLog(`ERROR stack: ${error.stack}`);
        throw error;
      }
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes what is returned (full content, attachments, messages) but lacks details on error handling, rate limits, authentication needs, or whether it's read-only (implied by 'Get' but not explicit). This is adequate but has clear gaps for a tool with no annotations.

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 two concise sentences with zero waste: the first states the purpose and parameter, the second specifies the return values. It is front-loaded and every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is mostly complete. It covers purpose, parameter context, and return values. However, without annotations or output schema, it could benefit from more behavioral details (e.g., error cases), preventing a perfect score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents the single parameter. The description adds value by clarifying the parameter's purpose ('Get full content of an email thread by ID') and indirectly linking it to search_gmail, but does not provide additional syntax or format details beyond the schema. With only one parameter, a baseline of 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Get full content'), resource ('an email thread by ID'), and scope ('complete email body, attachments info, and all messages in the thread'), distinguishing it from sibling tools like search_gmail which likely returns metadata or summaries rather than full content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by specifying 'get this from search_gmail results' in the schema, suggesting this tool is used after search_gmail to retrieve detailed content. However, it does not explicitly state when not to use it or name alternatives, keeping it from a perfect score.

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/PromptishOperations/mcpSpec'

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