Skip to main content
Glama
p-l-ta

mail-mcp

by p-l-ta

create_mailbox

Create a new mailbox folder in a Mail.app account. Specify the account name if multiple accounts are configured.

Instructions

Create a new mailbox (folder) in a Mail.app account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName for the new mailbox/folder
accountNoAccount name to create it in. Required when multiple accounts are configured; use name from list_accounts_and_mailboxes.

Implementation Reference

  • Handler function that executes the create_mailbox tool logic. Takes name (required) and account (optional), runs AppleScript to create a new mailbox in Mail.app.
    async ({ name, account }) => {
      const result = await runAppleScript({
        script: SCRIPT,
        args: {
          theMailboxName: name,
          theAcct: account ?? "",
        },
      });
      return { content: [{ type: "text", text: result }] };
    },
  • Zod schema defining the input parameters: name (required string) and account (optional string).
    const schema = {
      name: z.string().describe("Name for the new mailbox/folder"),
      account: z.string().optional().describe("Account name to create it in. Required when multiple accounts are configured; use name from list_accounts_and_mailboxes."),
    };
  • Registration function that registers the tool with the MCP server using server.tool().
    export function register(server: McpServer): void {
      server.tool(
        "create_mailbox",
        "Create a new mailbox (folder) in a Mail.app account.",
        schema,
        { title: "Create Mailbox", readOnlyHint: false, destructiveHint: false },
        async ({ name, account }) => {
          const result = await runAppleScript({
            script: SCRIPT,
            args: {
              theMailboxName: name,
              theAcct: account ?? "",
            },
          });
          return { content: [{ type: "text", text: result }] };
        },
      );
    }
  • src/server.ts:34-38 (registration)
    Call site in server.ts that invokes registerCreateMailbox to register the tool.
    registerCreateMailbox(server);
    registerBulkMarkRead(server);
    registerGetUnsubscribeLink(server);
    registerListSenders(server);
    registerEmptyMailbox(server);
  • Helper utility that writes AppleScript to a temp file and executes it via osascript, securely passing arguments through argv.
    export async function runAppleScript(opts: RunAppleScriptOptions): Promise<string> {
      const { script, args = {}, timeoutMs = 30_000 } = opts;
    
      const argNames = Object.keys(args);
      const argValues = argNames.map((n) => args[n]!);
    
      const bindings = argNames
        .map((name, i) => `  set ${name} to item ${i + 1} of argv`)
        .join("\n");
    
      const wrapped = `on run argv\n${bindings}\n${script}\nend run\n`;
    
      const dir = await mkdtemp(path.join(tmpdir(), "mail-mcp-"));
      const scriptPath = path.join(dir, "script.applescript");
      try {
        await writeFile(scriptPath, wrapped, "utf8");
        const { stdout } = await execFileP("osascript", [scriptPath, ...argValues], {
          timeout: timeoutMs,
          maxBuffer: 10 * 1024 * 1024,
        });
        return stdout.trimEnd();
      } finally {
        await rm(dir, { recursive: true, force: true }).catch(() => {});
      }
    }
Behavior2/5

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

Annotations indicate readOnlyHint=false and destructiveHint=false, which the description matches by stating 'Create'. However, no additional behavioral context is provided, such as error handling, permissions, or side effects like duplicate names.

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, clear sentence with no wasted words, front-loading the action and resource.

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?

For a simple tool with two parameters and no output schema, the description covers the core purpose but lacks usage context (e.g., account must exist, name uniqueness). Adequate but not comprehensive.

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?

Input schema has 100% description coverage for both parameters. The description adds no extra parameter information, but the baseline is 3 as per guidelines.

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 'Create a new mailbox (folder) in a Mail.app account', providing a specific verb and resource. It distinguishes from sibling tools that focus on reading, sending, or trashing emails.

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?

No explicit guidance on when to use this tool versus alternatives. The description does not mention prerequisites (e.g., account must exist) or when creation is appropriate.

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/p-l-ta/mail-mcp'

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