Skip to main content
Glama
carterlasalle

mac-messages-mcp

tool_get_chats

Retrieve and list available group chats from the macOS Messages app using a Python bridge for efficient message management and integration.

Instructions

List available group chats from the Messages app.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for 'tool_get_chats' that queries the Messages database for group chats with display names, filters and formats them for listing.
    @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)}"

Other Tools

Related 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/carterlasalle/mac_messages_mcp'

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