send_imessage
Send iMessages directly from Claude Desktop to phone numbers or email addresses using the macOS Messages app.
Instructions
Send an iMessage using Messages app
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recipient | Yes | Phone number or email of the recipient | |
| message | Yes | Message content to send |
Implementation Reference
- src/index.ts:161-197 (handler)Handler for the send_imessage tool. Extracts recipient and message from arguments, validates them, escapes the message for AppleScript, executes AppleScript to send the iMessage via Messages app, and returns success or error response.case "send_imessage": { const recipient = String(request.params.arguments?.recipient); const message = String(request.params.arguments?.message); if (!recipient || !message) { throw new Error("Recipient and message are required"); } const escapedMessage = message.replace(/"/g, '\\"'); const script = ` tell application "Messages" send "${escapedMessage}" to buddy "${recipient}" of (service 1 whose service type = iMessage) end tell `; try { await runAppleScript(script); return { content: [ { type: "text", text: `Message sent successfully to ${recipient}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Failed to send message: ${getErrorMessage(error)}`, }, ], isError: true, }; } }
- src/index.ts:126-139 (schema)Input schema definition for send_imessage tool, specifying recipient and message as required string properties.inputSchema: { type: "object", properties: { recipient: { type: "string", description: "Phone number or email of the recipient", }, message: { type: "string", description: "Message content to send", }, }, required: ["recipient", "message"], },
- src/index.ts:123-140 (registration)Registration of the send_imessage tool in the ListTools response, including name, description, and input schema.{ name: "send_imessage", description: "Send an iMessage using Messages app", inputSchema: { type: "object", properties: { recipient: { type: "string", description: "Phone number or email of the recipient", }, message: { type: "string", description: "Message content to send", }, }, required: ["recipient", "message"], }, },