Skip to main content
Glama
billyfranklim1

mcp-evolution

Archive Chat

archive_chat

Archive or unarchive a WhatsApp chat by providing the chat JID and last message object.

Instructions

Archive or unarchive a WhatsApp chat via the pinned instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lastMessageYesLast message object of the chat
chatYesJID of the chat to archive/unarchive
archiveYestrue to archive, false to unarchive

Implementation Reference

  • The main tool handler: registerArchiveChat registers the 'archive_chat' tool on the MCP server. The handler function (async) receives args (lastMessage, chat, archive), POSTs to /chat/archiveChat/{instanceName}, and returns the result as text content. Errors are caught and returned as McpError if applicable.
    export function registerArchiveChat(server: McpServer, client: EvolutionClient): void {
      server.registerTool(
        "archive_chat",
        {
          title: "Archive Chat",
          description: "Archive or unarchive a WhatsApp chat via the pinned instance.",
          inputSchema: schema,
        },
        async (args) => {
          try {
            const data = await client.post(`/chat/archiveChat/${client.instanceName}`, {
              lastMessage: args.lastMessage,
              chat: args.chat,
              archive: args.archive,
            });
            return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
          } catch (e) {
            if (e instanceof McpError) return { isError: true, content: [{ type: "text" as const, text: e.message }] };
            throw e;
          }
        }
      );
    }
  • Input schema for archive_chat: requires lastMessage (object with key containing remoteJid, fromMe, id), chat (string JID), and archive (boolean). Validated using zod.
    const schema = {
      lastMessage: z.object({
        key: z.object({
          remoteJid: z.string().optional(),
          fromMe: z.boolean().optional(),
          id: z.string().optional(),
        }),
      }).describe("Last message object of the chat"),
      chat: z.string().min(1).describe("JID of the chat to archive/unarchive"),
      archive: z.boolean().describe("true to archive, false to unarchive"),
    };
  • Import and registration in the central tools index: imports registerArchiveChat from './archive-chat.js' on line 28, and calls it on line 101 within registerAllTools.
    import { registerArchiveChat } from "./archive-chat.js";
    import { registerDeleteMessage } from "./delete-message.js";
    import { registerFetchProfilePicture } from "./fetch-profile-picture.js";
    import { registerDownloadMedia } from "./download-media.js";
    import { registerSendPresence } from "./send-presence.js";
    
    // Profile
    import { registerFetchBusinessProfile } from "./fetch-business-profile.js";
    import { registerUpdateProfileName } from "./update-profile-name.js";
    import { registerUpdateProfileStatus } from "./update-profile-status.js";
    import { registerUpdateProfilePicture } from "./update-profile-picture.js";
    import { registerRemoveProfilePicture } from "./remove-profile-picture.js";
    import { registerFetchPrivacy } from "./fetch-privacy.js";
    import { registerUpdatePrivacy } from "./update-privacy.js";
    
    // Group
    import { registerCreateGroup } from "./create-group.js";
    import { registerUpdateGroupSubject } from "./update-group-subject.js";
    import { registerUpdateGroupDescription } from "./update-group-description.js";
    import { registerUpdateGroupPicture } from "./update-group-picture.js";
    import { registerFetchInviteCode } from "./fetch-invite-code.js";
    import { registerRevokeInviteCode } from "./revoke-invite-code.js";
    import { registerAcceptInvite } from "./accept-invite.js";
    import { registerSendGroupInvite } from "./send-group-invite.js";
    import { registerUpdateParticipants } from "./update-participants.js";
    import { registerUpdateGroupSetting } from "./update-group-setting.js";
    import { registerLeaveGroup } from "./leave-group.js";
    import { registerFindGroupByInvite } from "./find-group-by-invite.js";
    
    // Instance
    import { registerConnectionState } from "./connection-state.js";
    import { registerRestartInstance } from "./restart-instance.js";
    import { registerLogoutInstance } from "./logout-instance.js";
    import { registerGetSettings } from "./get-settings.js";
    import { registerSetSettings } from "./set-settings.js";
    
    // Webhook
    import { registerFindWebhook } from "./find-webhook.js";
    import { registerSetWebhook } from "./set-webhook.js";
    
    // Label
    import { registerFindLabels } from "./find-labels.js";
    import { registerHandleLabel } from "./handle-label.js";
    
    // Block & Misc
    import { registerUpdateBlockStatus } from "./update-block-status.js";
    import { registerCheckNumber } from "./check-number.js";
    
    export function registerAllTools(server: McpServer, client: EvolutionClient): void {
      // Original
      registerListGroups(server, client);
      registerFindChats(server, client);
      registerFindContacts(server, client);
      registerFindMessages(server, client);
      registerGetChatHistory(server, client);
      registerSendText(server, client);
      registerSendMedia(server, client);
      registerGetGroupInfo(server, client);
      registerGetGroupResolvedParticipants(server, client);
    
      // Message
      registerSendAudio(server, client);
      registerSendSticker(server, client);
      registerSendLocation(server, client);
      registerSendContact(server, client);
      registerSendReaction(server, client);
      registerSendPoll(server, client);
      registerSendList(server, client);
      registerSendButton(server, client);
      registerSendStatus(server, client);
    
      // Chat
      registerMarkAsRead(server, client);
      registerArchiveChat(server, client);
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states the basic action without mentioning side effects, required permissions, reversibility, or other important behaviors.

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 very concise, using a single sentence. It is front-loaded but perhaps too brief for a tool with a nested parameter.

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 no output schema and moderate complexity (3 params, 1 nested object), the description fails to explain return values, error conditions, or success indicators. It omits expected output format.

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 coverage is 100%, so the baseline is 3. The description adds no parameter-specific information beyond the schema definitions; it merely restates the action.

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?

The description clearly states the tool archives or unarchives a WhatsApp chat, using the verb 'archive/unarchive' and specifying the resource 'WhatsApp chat'. It distinguishes itself from sibling tools, none of which provide archive functionality.

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, no prerequisites, and no context for exclusion. It only mentions 'via the pinned instance' but does not elaborate further.

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/billyfranklim1/mcp-evolution'

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