Skip to main content
Glama

mail_create_message

Create email messages with recipients, subject, and body content for sending through macOS Mail application.

Instructions

Create new email message with recipients, subject, and body

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
toYesRecipient email address
subjectYesEmail subject
bodyYesEmail body content
ccNoCC recipient email address (optional)

Implementation Reference

  • The handler logic for the 'mail_create_message' tool. It validates input parameters (to, subject, body, optional cc), constructs an AppleScript command using osascript to create a new outgoing message in the Mail app, executes it, and returns the result or error.
    case 'mail_create_message':
      try {
        const to = (args?.to as string) || '';
        const subject = (args?.subject as string) || '';
        const body = (args?.body as string) || '';
        const cc = (args?.cc as string) || '';
        
        if (!to || !subject || !body) {
          return {
            content: [
              {
                type: 'text',
                text: 'Error: to, subject, and body are required',
              },
            ],
          };
        }
        
        const command = `osascript -e 'on run argv
          set toAddress to item 1 of argv
          set mailSubject to item 2 of argv
          set mailBody to item 3 of argv
          set ccAddress to item 4 of argv
          
          tell application "Mail"
            set newMessage to make new outgoing message
            set subject of newMessage to mailSubject
            set content of newMessage to mailBody
            make new to recipient at end of to recipients of newMessage with properties {address:toAddress}
            if ccAddress is not "" then
              make new cc recipient at end of cc recipients of newMessage with properties {address:ccAddress}
            end if
            return "Message created - Subject: " & subject of newMessage & ", To: " & toAddress
          end tell
        end run' -- "${to}" "${subject}" "${body}" "${cc}"`;
        
        const { stdout, stderr } = await execAsync(command);
        
        if (stderr.trim()) {
          return {
            content: [
              {
                type: 'text',
                text: `Error creating message: ${stderr.trim()}`,
              },
            ],
          };
        }
        
        return {
          content: [
            {
              type: 'text',
              text: stdout.trim(),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: 'text',
              text: `Error executing mail create command: ${error.message}`,
            },
          ],
        };
      }
  • src/index.ts:297-321 (registration)
    Registration of the 'mail_create_message' tool in the ListTools handler, including its name, description, and input schema definition.
      name: 'mail_create_message',
      description: 'Create new email message with recipients, subject, and body',
      inputSchema: {
        type: 'object',
        properties: {
          to: {
            type: 'string',
            description: 'Recipient email address',
          },
          subject: {
            type: 'string',
            description: 'Email subject',
          },
          body: {
            type: 'string',
            description: 'Email body content',
          },
          cc: {
            type: 'string',
            description: 'CC recipient email address (optional)',
          },
        },
        required: ['to', 'subject', 'body'],
      },
    },
  • Input schema definition for the 'mail_create_message' tool, specifying properties and required fields.
      name: 'mail_create_message',
      description: 'Create new email message with recipients, subject, and body',
      inputSchema: {
        type: 'object',
        properties: {
          to: {
            type: 'string',
            description: 'Recipient email address',
          },
          subject: {
            type: 'string',
            description: 'Email subject',
          },
          body: {
            type: 'string',
            description: 'Email body content',
          },
          cc: {
            type: 'string',
            description: 'CC recipient email address (optional)',
          },
        },
        required: ['to', 'subject', 'body'],
      },
    },
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a creation operation but doesn't mention whether this actually sends the email, saves it as a draft, requires specific permissions, has rate limits, or what happens on success/failure. For a tool that presumably creates email messages, this leaves critical behavioral aspects undocumented.

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 a single, efficient sentence that communicates the core functionality without unnecessary words. It's appropriately sized for a straightforward creation tool and gets directly to the point with zero wasted verbiage.

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

Completeness2/5

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

For a tool that creates email messages with no annotations and no output schema, the description is insufficient. It doesn't clarify the relationship with 'mail_send_message', doesn't explain what happens after creation (draft vs. sent), and provides no behavioral context. Given the complexity of email operations and the lack of structured metadata, more guidance is needed.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description mentions recipients, subject, and body which aligns with the required parameters, but adds no additional semantic context beyond what's in the schema. This meets the baseline expectation when schema coverage is complete.

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 ('create new email message') and specifies key components (recipients, subject, body), making the purpose immediately understandable. However, it doesn't explicitly differentiate from the sibling 'mail_send_message' tool, which appears to be a related but distinct operation.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'mail_send_message' or other communication tools. There's no mention of prerequisites, typical use cases, or when not to use it, leaving the agent with insufficient context for proper tool selection.

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/samicokar/mcp-mac'

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