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.
This commit is contained in:
google-labs-jules[bot]
2025-06-07 05:49:44 +00:00
parent 0671cc9445
commit 546c654111
8 changed files with 355 additions and 117 deletions

View File

@@ -45,12 +45,24 @@ services:
environment:
- PORT=8001
- GEMINI_API_KEY= AIzaSyA9fI1mron-NVgghygu7B4sco7t6raXB8M
- MCP_URL= http:planilla-mcp:5000/mcp
- MCP_URL=http://conversation-layer-mcp:5000/mcp
ports:
- "8001:8001"
networks:
- principal
conversation-layer-mcp:
build: ./mcp
image: gitea.interno.com/nucleo000/conversation-layer-mcp:latest
container_name: conversation-layer-mcp
environment:
- PORT=5000
- WHATSAPP_ROUTER_URL=http://whatsapp-router:3001
ports:
- "5000:5000"
networks:
- principal
volumes:
nucleo_whatsapp_sessions: