Skip to main content
Glama
carterlasalle

mac-messages-mcp

tool_check_imessage_availability

Check if a recipient can receive iMessages to determine whether to send via iMessage or SMS/RCS. Helps resolve delivery issues by identifying the appropriate messaging service.

Instructions

Check if a recipient has iMessage available.

This tool helps determine whether to send via iMessage or SMS/RCS.
Useful for debugging delivery issues or choosing the right service.

Args:
    recipient: Phone number or email to check for iMessage availability

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
recipientYes

Implementation Reference

  • The MCP tool handler decorated with @mcp.tool(). It receives the recipient parameter, calls the helper _check_imessage_availability, and returns a formatted string indicating iMessage availability with emojis and explanations.
    @mcp.tool()
    def tool_check_imessage_availability(ctx: Context, recipient: str) -> str:
        """
        Check if a recipient has iMessage available.
        
        This tool helps determine whether to send via iMessage or SMS/RCS.
        Useful for debugging delivery issues or choosing the right service.
        
        Args:
            recipient: Phone number or email to check for iMessage availability
        """
        logger.info(f"Checking iMessage availability for: {recipient}")
        try:
            recipient = str(recipient)
            has_imessage = _check_imessage_availability(recipient)
            
            if has_imessage:
                return f"✅ {recipient} has iMessage available - messages will be sent via iMessage"
            else:
                # Check if it looks like a phone number for SMS fallback
                if any(c.isdigit() for c in recipient):
                    return f"📱 {recipient} does not have iMessage - messages will automatically fall back to SMS/RCS"
                else:
                    return f"❌ {recipient} does not have iMessage and SMS is not available for email addresses"
        except Exception as e:
            logger.error(f"Error checking iMessage availability: {str(e)}")
            return f"Error checking iMessage availability: {str(e)}"
  • The core helper function that executes AppleScript to query the Messages app for whether a buddy (recipient) exists in the iMessage service, returning a boolean.
    def _check_imessage_availability(recipient: str) -> bool:
        """
        Check if recipient has iMessage available.
        
        Args:
            recipient: Phone number or email to check
            
        Returns:
            True if iMessage is available, False otherwise
        """
        safe_recipient = recipient.replace('"', '\\"')
        
        script = f'''
        tell application "Messages"
            try
                set targetService to 1st service whose service type = iMessage
                set targetBuddy to buddy "{safe_recipient}" of targetService
                
                -- Check if buddy exists and has iMessage capability
                if targetBuddy exists then
                    return "true"
                else
                    return "false"
                end if
            on error
                return "false"
            end try
        end tell
        '''
        
        try:
            result = run_applescript(script)
            return result.strip().lower() == "true"
        except:
            return False
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool's purpose and use cases but lacks details on behavioral traits like what 'availability' means (e.g., online status, service registration), potential errors (e.g., invalid recipient format), or side effects (e.g., rate limits, privacy implications). For a tool with no annotation coverage, this is a significant gap.

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 appropriately sized and front-loaded: it starts with the core purpose, followed by usage context and parameter details in a structured 'Args:' section. Every sentence adds value without redundancy, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (1 parameter, no output schema, no annotations), the description is adequate but incomplete. It covers purpose, usage, and parameter semantics but lacks behavioral details (e.g., return format, error handling) and doesn't leverage sibling context to clarify distinctions. It meets minimum viability but has clear gaps.

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?

The schema description coverage is 0%, so the description must compensate. It adds meaning by explaining that the 'recipient' parameter is a 'Phone number or email to check for iMessage availability,' which clarifies the expected input format beyond the schema's generic string type. However, it doesn't cover validation rules or examples, leaving some ambiguity.

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 tool's purpose: 'Check if a recipient has iMessage available.' It specifies the verb ('check') and resource ('iMessage availability'), making the action explicit. However, it doesn't distinguish this tool from sibling tools like 'tool_check_contacts' or 'tool_check_addressbook' in terms of scope or domain, 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 Guidelines4/5

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

The description provides clear context for when to use the tool: 'Useful for debugging delivery issues or choosing the right service.' It implies usage scenarios (debugging and service selection) but does not explicitly state when not to use it or name alternatives among siblings, such as 'tool_send_message' for actual sending, which would be needed for a score of 5.

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/carterlasalle/mac_messages_mcp'

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