Skip to main content
Glama
jcontini

macOS Contacts MCP

by jcontini

create_contact

Add new contacts to macOS Contacts app by providing name, organization, job title, emails, phones, URLs, and notes.

Instructions

Create a new contact

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesFull name of the contact
organizationNoOrganization or company name
job_titleNoJob title or position
emailsNoEmail addresses
phonesNoPhone numbers
urlsNoURLs (social media, websites, etc.) with labels
noteNoNotes about the contact

Implementation Reference

  • Implements the core logic for creating a new contact in the macOS Contacts app using dynamically generated AppleScript. Parses input arguments, escapes strings, constructs and executes the script to add a new person with optional fields like organization, job title, emails, phones, URLs, and notes.
    private async createContact(args: any): Promise<any> {
      const { name, organization = '', job_title = '', emails = [], phones = [], urls = [], note = '' } = args;
    
      // Parse name into first/last name
      const nameParts = name.trim().split(' ');
      const firstName = nameParts[0] || '';
      const lastName = nameParts.length > 1 ? nameParts.slice(1).join(' ') : '';
    
      let script = `
        tell application "Contacts"
          set newPerson to make new person
          
          if "${this.escapeForAppleScript(firstName)}" is not "" then
            set first name of newPerson to "${this.escapeForAppleScript(firstName)}"
          end if
          
          if "${this.escapeForAppleScript(lastName)}" is not "" then
            set last name of newPerson to "${this.escapeForAppleScript(lastName)}"
          end if
          
          if "${this.escapeForAppleScript(organization)}" is not "" then
            set organization of newPerson to "${this.escapeForAppleScript(organization)}"
          end if
          
          if "${this.escapeForAppleScript(job_title)}" is not "" then
            set job title of newPerson to "${this.escapeForAppleScript(job_title)}"
          end if
          
          if "${this.escapeForAppleScript(note)}" is not "" then
            set note of newPerson to "${this.escapeForAppleScript(note)}"
          end if
      `;
    
      // Add emails
      if (emails.length > 0) {
        emails.forEach((email: string, index: number) => {
          const label = index === 0 ? 'home' : index === 1 ? 'work' : `email${index + 1}`;
          script += `\n        make new email at end of emails of newPerson with properties {label:"${label}", value:"${this.escapeForAppleScript(email)}"}`;
        });
      }
    
      // Add phones
      if (phones.length > 0) {
        phones.forEach((phone: string, index: number) => {
          const label = index === 0 ? 'home' : index === 1 ? 'work' : `phone${index + 1}`;
          script += `\n        make new phone at end of phones of newPerson with properties {label:"${label}", value:"${this.escapeForAppleScript(phone)}"}`;
        });
      }
    
      // Add URLs
      if (urls.length > 0) {
        urls.forEach((url: any) => {
          script += `\n        make new url at end of urls of newPerson with properties {label:"${this.escapeForAppleScript(url.label)}", value:"${this.escapeForAppleScript(url.value)}"}`;
        });
      }
    
      script += `
          save
          return id of newPerson
        end tell
      `;
    
      try {
        const contactId = this.executeAppleScript(script);
        
        return {
          success: true,
          message: `Created contact: ${name}`,
          contact_id: contactId,
          contact: { name, organization, job_title, emails, phones, urls, note },
        };
      } catch (error) {
        throw new Error(`Create contact failed: ${error}`);
      }
    }
  • src/index.ts:80-127 (registration)
    Registers the 'create_contact' tool in the ListTools response, including its name, description, and detailed input schema defining parameters like name (required), organization, job_title, emails, phones, urls, and note.
    {
      name: 'create_contact',
      description: 'Create a new contact',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Full name of the contact',
          },
          organization: {
            type: 'string',
            description: 'Organization or company name',
          },
          job_title: {
            type: 'string',
            description: 'Job title or position',
          },
          emails: {
            type: 'array',
            items: { type: 'string' },
            description: 'Email addresses',
          },
          phones: {
            type: 'array',
            items: { type: 'string' },
            description: 'Phone numbers',
          },
          urls: {
            type: 'array',
            items: {
              type: 'object',
              properties: {
                label: { type: 'string' },
                value: { type: 'string' },
              },
              required: ['label', 'value'],
            },
            description: 'URLs (social media, websites, etc.) with labels',
          },
          note: {
            type: 'string',
            description: 'Notes about the contact',
          },
        },
        required: ['name'],
      },
    },
  • Defines the input schema for the create_contact tool, specifying the structure and types for all parameters, with 'name' as the only required field.
    inputSchema: {
      type: 'object',
      properties: {
        name: {
          type: 'string',
          description: 'Full name of the contact',
        },
        organization: {
          type: 'string',
          description: 'Organization or company name',
        },
        job_title: {
          type: 'string',
          description: 'Job title or position',
        },
        emails: {
          type: 'array',
          items: { type: 'string' },
          description: 'Email addresses',
        },
        phones: {
          type: 'array',
          items: { type: 'string' },
          description: 'Phone numbers',
        },
        urls: {
          type: 'array',
          items: {
            type: 'object',
            properties: {
              label: { type: 'string' },
              value: { type: 'string' },
            },
            required: ['label', 'value'],
          },
          description: 'URLs (social media, websites, etc.) with labels',
        },
        note: {
          type: 'string',
          description: 'Notes about the contact',
        },
      },
      required: ['name'],
    },
  • Dispatcher case in the CallToolRequest handler that routes 'create_contact' calls to the createContact method.
    case 'create_contact':
      result = await this.createContact(args);
      break;
  • TypeScript interface defining the structure of a Contact object, used across tool implementations including create_contact for type consistency.
    interface Contact {
      id?: string;
      name: string;
      organization?: string;
      job_title?: string;
      emails?: string[];
      phones?: string[];
      urls?: { label: string; value: string }[];
      note?: string;
      creation_date?: string;
      modification_date?: string;
      image?: string; // base64
    }
Behavior2/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. 'Create a new contact' implies a write operation but doesn't specify permissions needed, whether duplicates are allowed, error conditions, or what happens on success. This is inadequate for a mutation tool with zero annotation coverage.

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 with no wasted words. It's front-loaded and directly states the tool's purpose, making it easy to parse quickly.

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 mutation tool with 7 parameters, no annotations, and no output schema, the description is incomplete. It lacks behavioral context, usage guidelines, and any indication of what the tool returns, leaving significant gaps for an AI agent to operate effectively.

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 fully documents all 7 parameters. The description adds no additional meaning beyond the schema, such as explaining relationships between parameters or usage examples. Baseline 3 is appropriate when the schema does all the work.

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') and resource ('contact'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'update_contact' or specify what makes a 'new' contact distinct, which prevents a perfect score.

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 'update_contact' or 'get_contact'. It doesn't mention prerequisites, such as when a contact might already exist, leaving the agent to infer usage from context alone.

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/jcontini/macos-contacts-mcp'

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