Skip to main content
Glama
jcontini

macOS Contacts MCP

by jcontini

get_recent_contacts

Retrieve macOS Contacts created or modified within a specified date range to track recent contact changes and updates.

Instructions

Get contacts created or modified within a date range

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
days_backNoNumber of days back to search
typeNoType of date to filter bymodified
limitNoMaximum number of results to return

Implementation Reference

  • The main handler function that implements the get_recent_contacts tool by executing AppleScript to fetch recent contacts from macOS Contacts app.
      private async getRecentContacts(args: any): Promise<any> {
        const { days_back = 30, type = 'modified', limit = 20 } = args;
    
        // Use a unique delimiter that won't conflict with dates
        const script = `tell application "Contacts"
      set contactList to {}
      set allPeople to people
      repeat with i from 1 to ${Math.min(limit, 20)}
        if i > (count of allPeople) then exit repeat
        set aPerson to item i of allPeople
        set end of contactList to (name of aPerson & "###SPLIT###" & modification date of aPerson & "###END###")
      end repeat
      return contactList
    end tell`;
    
        try {
          const result = this.executeAppleScript(script);
          if (!result) {
            return { success: true, type, days_back, count: 0, contacts: [] };
          }
          
          // Split by ###END### to separate entries
          const entries = result.split('###END###').filter(entry => entry.trim());
          
          const contacts = entries.map(entry => {
            const cleanEntry = entry.replace(/^, /, ''); // Remove leading comma
            const parts = cleanEntry.split('###SPLIT###');
            return {
              name: parts[0] || '',
              modification_date: parts[1] || '',
            };
          }).slice(0, limit);
          
          return {
            success: true,
            type,
            days_back,
            count: contacts.length,
            contacts,
          };
        } catch (error) {
          throw new Error(`Get recent contacts failed: ${error}`);
        }
      }
  • Input schema defining parameters for the get_recent_contacts tool: days_back, type (created/modified/both), and limit.
    inputSchema: {
      type: 'object',
      properties: {
        days_back: {
          type: 'integer',
          description: 'Number of days back to search',
          default: 30,
        },
        type: {
          type: 'string',
          enum: ['created', 'modified', 'both'],
          description: 'Type of date to filter by',
          default: 'modified',
        },
        limit: {
          type: 'integer',
          description: 'Maximum number of results to return',
          default: 20,
        },
      },
  • src/index.ts:180-204 (registration)
    Tool registration entry in the ListToolsRequestSchema response, including name, description, and input schema.
    {
      name: 'get_recent_contacts',
      description: 'Get contacts created or modified within a date range',
      inputSchema: {
        type: 'object',
        properties: {
          days_back: {
            type: 'integer',
            description: 'Number of days back to search',
            default: 30,
          },
          type: {
            type: 'string',
            enum: ['created', 'modified', 'both'],
            description: 'Type of date to filter by',
            default: 'modified',
          },
          limit: {
            type: 'integer',
            description: 'Maximum number of results to return',
            default: 20,
          },
        },
      },
    },
  • src/index.ts:228-230 (registration)
    Dispatch case in the CallToolRequestSchema handler that routes calls to the getRecentContacts handler function.
    case 'get_recent_contacts':
      result = await this.getRecentContacts(args);
      break;
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. It states the tool retrieves contacts based on date criteria but doesn't mention important behaviors like whether it's read-only (implied by 'Get'), pagination details beyond the 'limit' parameter, error handling, or performance considerations. The description is minimal and lacks context about what the tool actually does beyond the basic filter.

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 front-loads the core purpose without any wasted words. It directly communicates what the tool does in a clear and concise manner.

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?

Given no annotations and no output schema, the description is incomplete for a tool with 3 parameters and behavioral implications. It doesn't explain what the return values look like (e.g., list of contacts with fields), error cases, or how it interacts with sibling tools. For a retrieval tool with date filtering, more context is needed to guide effective use.

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 adds no additional meaning beyond implying date-range filtering, which is already covered in the schema. This meets the baseline of 3 for high schema coverage without extra param info in the description.

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 ('Get contacts') and scope ('created or modified within a date range'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'get_contact' (singular) or 'search_contacts', which might offer different filtering capabilities or scopes.

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 'get_contact' or 'search_contacts'. It mentions a date range filter but doesn't specify if this is the primary method for retrieving recent contacts or if other tools might be better for different use cases.

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