Skip to main content
Glama
carterlasalle

mac-messages-mcp

tool_get_chats

Retrieve group chat listings from macOS Messages app to access conversation history and manage communication threads.

Instructions

List available group chats from the Messages app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool_get_chats function implements the core logic for retrieving and formatting available group chats from the Messages database. It is registered via the @mcp.tool() decorator.
    @mcp.tool() def tool_get_chats(ctx: Context) -> str: """ List available group chats from the Messages app. """ logger.info("Getting available chats") try: query = "SELECT chat_identifier, display_name FROM chat WHERE display_name IS NOT NULL" results = query_messages_db(query) if not results: return "No group chats found." if "error" in results[0]: return f"Error accessing chats: {results[0]['error']}" # Filter out chats without display names and format the results chats = [r for r in results if r.get('display_name')] if not chats: return "No named group chats found." formatted_chats = [] for i, chat in enumerate(chats, 1): formatted_chats.append(f"{i}. {chat['display_name']} (ID: {chat['chat_identifier']})") return "Available group chats:\n" + "\n".join(formatted_chats) except Exception as e: logger.error(f"Error getting chats: {str(e)}") return f"Error getting chats: {str(e)}"

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