Skip to main content
Glama

messages_list_chats

Retrieve a list of available iMessage and SMS chats from macOS, optionally including participant details for each conversation.

Instructions

[iMessage operations] List available iMessage and SMS chats

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
includeParticipantDetailsNoInclude detailed participant information

Implementation Reference

  • Handler implementation for the 'messages_list_chats' tool. Defines the AppleScript logic to list iMessage/SMS chats, including optional participant details.
    {
      name: "list_chats",
      description: "List available iMessage and SMS chats",
      schema: {
        type: "object",
        properties: {
          includeParticipantDetails: {
            type: "boolean",
            description: "Include detailed participant information",
            default: false
          }
        }
      },
      script: (args) => `
        tell application "Messages"
          set chatList to {}
          repeat with aChat in chats
            set chatName to name of aChat
            if chatName is missing value then
              set chatName to ""
              -- Try to get the contact name for individual chats
              try
                set theParticipants to participants of aChat
                if (count of theParticipants) is 1 then
                  set theParticipant to item 1 of theParticipants
                  set chatName to name of theParticipant
                end if
              end try
            end if
            
            set chatInfo to {id:id of aChat, name:chatName, isGroupChat:(id of aChat contains "+")}
            
            ${args.includeParticipantDetails ? `
            -- Add participant details if requested
            set participantList to {}
            repeat with aParticipant in participants of aChat
              set participantInfo to {id:id of aParticipant, handle:handle of aParticipant}
              try
                set participantInfo to participantInfo & {name:name of aParticipant}
              end try
              copy participantInfo to end of participantList
            end repeat
            set chatInfo to chatInfo & {participant:participantList}
            ` : ''}
            
            copy chatInfo to end of chatList
          end repeat
          return chatList
        end tell
      `
    },
  • Input schema for 'messages_list_chats' tool, defining optional 'includeParticipantDetails' parameter.
    schema: {
      type: "object",
      properties: {
        includeParticipantDetails: {
          type: "boolean",
          description: "Include detailed participant information",
          default: false
        }
      }
    },
  • src/index.ts:34-35 (registration)
    Registers the 'messages' category (containing list_chats script) with the MCP server framework.
    server.addCategory(messagesCategory);
    server.addCategory(notesCategory);
  • Dynamically registers all category scripts as MCP tools in ListToolsRequestHandler, constructing names like 'messages_list_chats'.
    tools: this.categories.flatMap((category) =>
      category.scripts.map((script) => ({
        name: `${category.name}_${script.name}`, // Changed from dot to underscore
        description: `[${category.description}] ${script.description}`,
        inputSchema: script.schema || {
          type: "object",
          properties: {},
        },
      })),
    ),
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states it's a list operation, implying read-only behavior, but doesn't mention permissions, rate limits, pagination, or what 'available' means (e.g., recent chats, all chats). This leaves significant gaps for a tool that accesses personal data.

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

Conciseness5/5

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

The description is extremely concise with a single, front-loaded sentence that directly states the tool's purpose. There is no wasted verbiage or redundancy, making it efficient and easy to parse.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of accessing personal messaging data, no annotations, and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., privacy implications, data format), usage context, and output expectations, leaving the agent under-informed for safe and effective use.

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

Parameters3/5

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

Schema description coverage is 100%, so the schema fully documents the single parameter. The description adds no parameter-specific information beyond what's in the schema, resulting in a baseline score of 3. No additional value is provided to compensate for or enhance the schema.

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 resource ('available iMessage and SMS chats'), making the purpose immediately understandable. It specifies the scope (iMessage and SMS chats) but doesn't differentiate from sibling tools like 'messages_get_messages' or 'messages_search_messages', which prevents a perfect score.

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 'messages_get_messages' or 'messages_search_messages'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent without direction on tool selection.

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/joshrutkowski/applescript-mcp'

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