send_message
Send text messages to phone numbers or email addresses using iMessage on macOS through the MCP server.
Instructions
Send an iMessage to a phone number or email address.
Args: recipient: Phone number (e.g. +15551234567) or email address text: Message text to send
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recipient | Yes | ||
| text | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:237-257 (handler)The actual implementation of the send_message tool, which uses AppleScript to send an iMessage.
async def send_message(recipient: str, text: str) -> str: """Send an iMessage to a phone number or email address. Args: recipient: Phone number (e.g. +15551234567) or email address text: Message text to send """ escaped_recipient = _escape_applescript(recipient) escaped_text = _escape_applescript(text) script = ( 'tell application "Messages"\n' f' send "{escaped_text}" to buddy "{escaped_recipient}" ' 'of (service 1 whose service type is iMessage)\n' "end tell" ) proc = await asyncio.create_subprocess_exec( "osascript", "-e", script, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE, - server.py:236-236 (registration)MCP tool registration for send_message.
@mcp.tool()