Skip to main content
Glama
viraatdas

iMessage MCP Server

by viraatdas

list_conversations

Retrieve recent iMessage and SMS conversations with previews of the last messages to monitor communication history.

Instructions

List recent iMessage/SMS conversations with last message preview.

Args: limit: Max number of conversations to return (default 20)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • server.py:46-89 (handler)
    The `list_conversations` tool is registered using `@mcp.tool()` and implemented as an async function that queries the macOS iMessage `chat.db` SQLite database to list recent conversations.
    @mcp.tool()
    async def list_conversations(limit: int = 20) -> str:
        """List recent iMessage/SMS conversations with last message preview.
    
        Args:
            limit: Max number of conversations to return (default 20)
        """
        db = _get_db()
        rows = db.execute(
            """
            SELECT
                c.chat_identifier,
                c.display_name,
                c.service_name,
                MAX(m.date) as last_date,
                COUNT(m.ROWID) as message_count,
                (SELECT m2.text FROM message m2
                 JOIN chat_message_join cmj2 ON cmj2.message_id = m2.ROWID
                 WHERE cmj2.chat_id = c.ROWID AND m2.text IS NOT NULL
                 ORDER BY m2.date DESC LIMIT 1) as last_message
            FROM chat c
            LEFT JOIN chat_message_join cmj ON c.ROWID = cmj.chat_id
            LEFT JOIN message m ON cmj.message_id = m.ROWID
            GROUP BY c.ROWID
            ORDER BY last_date DESC
            LIMIT ?
            """,
            (limit,),
        ).fetchall()
        db.close()
    
        conversations = []
        for r in rows:
            conversations.append(
                {
                    "chat_identifier": r["chat_identifier"],
                    "display_name": r["display_name"] or "",
                    "service": r["service_name"] or "",
                    "message_count": r["message_count"],
                    "last_message_date": _apple_ts_to_iso(r["last_date"]),
                    "last_message": (r["last_message"] or "")[:200],
                }
            )
        return json.dumps(conversations, indent=2)
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. It successfully indicates the data is ordered by recency ('recent') and that returned messages are previews only, not full content. However, it lacks disclosure on what 'recent' means (time window), whether the operation is read-only (implied but not stated), pagination behavior beyond the limit, or any rate limiting concerns.

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?

The description is appropriately concise with two distinct sections: a clear action statement followed by parameter documentation. The main sentence front-loads the core purpose. The 'Args:' format is slightly informal but functional. No redundant or filler text is present.

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?

For a simple 1-parameter tool with an output schema, the description is minimally sufficient. It covers the core behavior and parameter semantics. However, given the lack of annotations and the potential ambiguity between this and get_messages, it should clarify the scope (conversations vs individual messages) and mention that it returns conversation metadata rather than full chat history.

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 description coverage is 0% (the schema contains only 'title' and 'default' but no 'description' field). The description compensates by explicitly documenting the limit parameter via the Args section: 'Max number of conversations to return (default 20)'. This provides clear semantics for the single optional parameter that the schema fails to describe.

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 verb 'List' and identifies the resource as 'iMessage/SMS conversations'. It adds valuable scope qualifiers 'recent' and 'last message preview' that distinguish this from sibling tools like get_messages (which presumably returns full message content) and search_messages. It doesn't explicitly state the distinction from get_messages in the description text, but the focus on 'conversations' vs 'messages' provides implicit differentiation.

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?

The description provides no guidance on when to use this tool versus alternatives like get_messages or search_messages. There is no mention of prerequisites, such as needing specific permissions for iMessage access, or when a user should prefer this conversation-level view over retrieving full message threads.

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