Skip to main content
Glama
viraatdas

iMessage MCP Server

by viraatdas

send_group_message

Send messages to iMessage group chats by specifying the group name and message text. This tool enables direct communication with multiple recipients through the iMessage platform on macOS.

Instructions

Send a message to a named group chat.

Args: group_name: The display name of the group chat text: Message text to send

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
group_nameYes
textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the `send_group_message` tool, which queries the database for the chat identifier and uses `osascript` to send the message via AppleScript.
    async def send_group_message(group_name: str, text: str) -> str:
        """Send a message to a named group chat.
    
        Args:
            group_name: The display name of the group chat
            text: Message text to send
        """
        # Resolve group name to chat identifier
        db = _get_db()
        row = db.execute(
            "SELECT chat_identifier FROM chat WHERE display_name = ? LIMIT 1",
            (group_name,),
        ).fetchone()
        db.close()
    
        if not row:
            return json.dumps({"error": f"Group chat '{group_name}' not found"})
    
        escaped_text = _escape_applescript(text)
        chat_id = row["chat_identifier"]
    
        script = (
            'tell application "Messages"\n'
            f'  send "{escaped_text}" to chat id "{chat_id}"\n'
            "end tell"
        )
    
        proc = await asyncio.create_subprocess_exec(
            "osascript", "-e", script,
            stdout=asyncio.subprocess.PIPE,
            stderr=asyncio.subprocess.PIPE,
        )
        stdout, stderr = await proc.communicate()
    
        if proc.returncode != 0:
            return json.dumps(
                {"error": f"Failed to send to group: {stderr.decode().strip()}"}
            )
    
        return json.dumps(
            {"status": "sent", "group": group_name, "chat_identifier": chat_id}
        )
  • server.py:269-270 (registration)
    Tool registration using the `@mcp.tool()` decorator.
    @mcp.tool()
    async def send_group_message(group_name: str, text: str) -> str:
Behavior2/5

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

No annotations provided, so description carries full burden. While 'Send' implies a write operation, there is no disclosure of failure modes (what if group doesn't exist?), side effects, rate limits, or whether the operation is idempotent. Description only states the happy path.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Brief and front-loaded with the action sentence. The 'Args:' section is slightly informal but necessary given empty schema descriptions. No redundant text, every line serves documentation purpose.

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 simple 2-parameter messaging tool with output schema available (return values need not be described). Missing behavioral context regarding group existence requirements and error cases prevents a higher score.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage (titles only). Description compensates by clarifying 'group_name' is the display name (distinguishing from ID) and 'text' is the message content. Adds essential semantics missing from structured fields.

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?

Clear specific verb ('Send'), resource ('message'), and target ('named group chat'). Explicitly distinguishes from sibling tool 'send_message' by specifying group chat context.

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?

No guidance on when to use this vs 'send_message' (individual vs group), no prerequisites mentioned (e.g., whether group must exist first), and no error handling guidance.

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/viraatdas/imessage-mcp'

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