Skip to main content
Glama
adamzaidi

icloud-mcp

by adamzaidi

search_contacts

Find iCloud contacts by searching names, email addresses, or phone numbers using text queries.

Instructions

Search iCloud Contacts by name, email address, or phone number.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesText to search for (matched against name, email, and phone)

Implementation Reference

  • Implementation of searchContacts function which queries iCloud CardDAV server for contacts matching a search query in FN, EMAIL, or TEL fields.
    export async function searchContacts(query) {
      const { dataHost, addressBookPath } = await discover();
    
      // Search FN, EMAIL, TEL — run three queries and merge
      const makeQuery = (propName) => `<?xml version="1.0" encoding="UTF-8"?>
    <C:addressbook-query xmlns:C="urn:ietf:params:xml:ns:carddav" xmlns:A="DAV:">
      <A:prop><A:getetag/><C:address-data/></A:prop>
      <C:filter>
        <C:prop-filter name="${propName}">
          <C:text-match collation="i;unicode-casemap" match-type="contains">${query}</C:text-match>
        </C:prop-filter>
      </C:filter>
    </C:addressbook-query>`;
    
      const url = `${dataHost}${addressBookPath}`;
      const opts = { depth: 1, contentType: 'application/xml; charset=utf-8' };
    
      const [fnResp, emailResp, telResp] = await Promise.all([
        davRequest('REPORT', url, { ...opts, body: makeQuery('FN') }),
        davRequest('REPORT', url, { ...opts, body: makeQuery('EMAIL') }),
        davRequest('REPORT', url, { ...opts, body: makeQuery('TEL') }),
      ]);
    
      // Merge and deduplicate by contactId
      const seen = new Set();
      const results = [];
      for (const resp of [fnResp, emailResp, telResp]) {
        for (const c of parseContactBlocks(resp.body)) {
          if (!seen.has(c.contactId)) {
            seen.add(c.contactId);
            results.push(c);
          }
        }
      }
    
      return { contacts: results, count: results.length, query };
    }
Behavior2/5

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

No annotations provided, yet description fails to disclose critical behavioral traits: whether search is case-sensitive, supports wildcards, returns partial matches, pagination limits, or what format results take. Does not confirm this is read-only/safe.

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?

Single, efficient sentence with zero redundancy. Action and resource front-loaded; every word earns its place.

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?

Adequate for a single-parameter tool with full schema coverage, but lacks mention of return value structure or empty-result behavior given the absence of an output schema.

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 coverage is 100%, establishing baseline 3. Description confirms the multi-field matching behavior (name/email/phone) but adds no syntax guidance (e.g., phone formatting) or examples beyond what the schema already documents.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Specific verb 'Search' with clear resource 'iCloud Contacts' and explicit scope (name, email, phone). Effectively distinguishes from siblings like list_contacts (full enumeration) and get_contact (direct retrieval by ID).

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?

Provides no guidance on when to use this versus list_contacts (for bulk export) or get_contact (for direct ID lookup). No mention of performance implications or search limits.

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/adamzaidi/icloud-mcp'

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