Skip to main content
Glama

send_email

Send emails through Gmail for revenue tracking and business management. Get user approval before sending messages to recipients.

Instructions

Send an email via Gmail. ALWAYS get user approval before calling this.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient email address
subjectYesEmail subject line
bodyYesEmail body content

Implementation Reference

  • index.js:366-377 (registration)
    Registration of the send_email tool in the ListTools response, including name, description, and input schema.
      name: "send_email",
      description: "Send an email via Gmail. ALWAYS get user approval before calling this.",
      inputSchema: {
        type: "object",
        properties: {
          to: { type: "string", description: "Recipient email address" },
          subject: { type: "string", description: "Email subject line" },
          body: { type: "string", description: "Email body content" }
        },
        required: ["to", "subject", "body"]
      }
    },
  • Handler implementation for the send_email tool, which calls the callAPI helper with action 'sendEmail' and tool arguments.
    case "send_email":
      result = await callAPI("sendEmail", args);
      break;
  • Input schema definition for the send_email tool, specifying required parameters: to, subject, body.
    inputSchema: {
      type: "object",
      properties: {
        to: { type: "string", description: "Recipient email address" },
        subject: { type: "string", description: "Email subject line" },
        body: { type: "string", description: "Email body content" }
      },
      required: ["to", "subject", "body"]
    }
  • The callAPI helper function that proxies tool calls to the external Google Apps Script API, handling form-encoded POST requests, logging, and error handling. This is where send_email logic is ultimately executed via action='sendEmail'.
    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 mentions the need for user approval, which is valuable context about permissions/safety. However, it doesn't describe other behavioral traits like whether the email is sent immediately, potential rate limits, error conditions, or what happens on success/failure.

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 extremely concise with just two sentences that are front-loaded and earn their place. The first sentence states the purpose, and the second provides critical usage guidance without any wasted words.

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

Completeness3/5

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

Given the tool's complexity (sending emails is a mutation with potential side effects), no annotations, and no output schema, the description is somewhat incomplete. It covers the approval requirement but lacks details on behavioral outcomes, error handling, or return values. However, the strong usage guideline partially compensates.

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?

The schema description coverage is 100%, so the schema already fully documents all three parameters (to, subject, body). The description adds no additional parameter information beyond what's in the schema, resulting in the baseline score of 3 for adequate but no extra value.

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 clearly states the action ('send') and resource ('email via Gmail'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'search_gmail' or 'get_email_content', which would require a 5.

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

Usage Guidelines5/5

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

The description provides explicit usage guidance with 'ALWAYS get user approval before calling this,' which clearly indicates when to use this tool (with approval) and implies caution. This is a strong directive that helps the agent understand the appropriate context for invocation.

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