google-labs-jules[bot] 546c654111 Refactor MCP resources to tools, add chat deletion
This commit implements two main changes based on your feedback:

1.  Refactors all Model Context Protocol (MCP) resources into tools:
    - In `whatsappIntegration.js`:
        - `whatsapp.chat` (resource) -> `whatsapp.list-chats` (tool) & `whatsapp.get-chat-details` (tool)
        - `whatsapp.contact` (resource) -> `whatsapp.get-contact-details` (tool)
        - `whatsapp.blocklist` (resource) -> `whatsapp.get-blocklist` (tool)
    - In `conversationIntegration.js`:
        - `conversation` (resource) -> `conversation.list-conversations` (tool) & `conversation.get-conversation-details` (tool)
    This change aligns with current Gemini SDK capabilities for MCP.

2.  Implements chat deletion functionality:
    - In `whatsapp-router`:
        - Added `deleteChat` function to `whatsappClient.ts`. This function calls an assumed OpenWA endpoint (`POST /deleteChat`) and will require verification against the actual OpenWA API.
        - Added a `DELETE /chats/:chatId` route to `whatsappActions.ts` that utilizes the new `deleteChat` client function.
    - In `conversation-layer-mcp`:
        - Added a new `whatsapp.delete-chat` tool to `whatsappIntegration.js`. This tool calls the new `DELETE /chats/:chatId` endpoint in `whatsapp-router`.

Additionally, the existing `conversation.delete` MCP tool was verified to be correctly implemented.
2025-06-07 05:49:44 +00:00
2025-06-04 22:09:26 -06:00
2025-06-05 00:34:57 -06:00

Conversation Layer

This module contains the services that handle messaging for WhatsApp and the web chat interface. All source code is now written in TypeScript. It is composed of four containers:

  • openwa provides access to WhatsApp through the open-wa project.
  • whatsapp-router receives webhook events from openwa and forwards messages to a conversation handler. Handlers can be configured per chat ID in whatsapp-router/src/chatHandlers.ts.
  • chat-ui simple web chat interface that also communicates with the LLM agent.
  • conversation-layer-agent lightweight agent that uses the Gemini SDK to answer questions about this repository.

All services can be launched together with docker-compose.

Usage

  1. Configure the URL of your LLM agent in docker-compose.yml (LLM_AGENT_URL).
  2. Set your Gemini API key in .env (GEMINI_API_KEY) so the conversation-layer-agent can use the Gemini SDK.
  3. Optionally edit whatsapp-router/src/chatHandlers.ts to map specific chat IDs to different handler URLs or local handlers. By default the chat ID 50498554225@c.us is mapped to a builtin HelloWorld agent for testing and repo-helper@c.us talks to the conversation-layer-agent.
  4. Run:
docker-compose up --build

The chat UI will be available on http://localhost:3000. Open-wa exposes its API on port 8080 and the WhatsApp router listens on port 3001. Alternatively you can run the chat UI and router locally using Make:

make chat     # start chat-ui
make router   # start whatsapp-router
make agent    # start conversation-layer-agent

Both targets read configuration from a .env file if it exists (see .env.example).

Description
No description provided
Readme 820 KiB
Languages
TypeScript 82.7%
JavaScript 14.3%
Dockerfile 1.3%
HTML 1.2%
Makefile 0.5%