@wahooks/channel 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +89 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137,9 +137,9 @@ const mcp = new Server({ name: "wahooks-channel", version: "0.1.0" }, {
|
|
|
137
137
|
},
|
|
138
138
|
instructions: [
|
|
139
139
|
"WhatsApp messages arrive as <channel source=\"wahooks-channel\" from=\"phone\" message_id=\"id\">.",
|
|
140
|
-
"Use
|
|
141
|
-
"
|
|
142
|
-
"
|
|
140
|
+
"Use wahooks_reply to respond to the sender. Use wahooks_send to message any phone.",
|
|
141
|
+
"Media tools: wahooks_send_image, wahooks_send_video, wahooks_send_audio, wahooks_send_document.",
|
|
142
|
+
"Also available: wahooks_send_location (lat/lng) and wahooks_send_contact (name/phone).",
|
|
143
143
|
"For permission requests, the user can reply 'yes XXXXX' or 'no XXXXX' where XXXXX is the request ID.",
|
|
144
144
|
].join(" "),
|
|
145
145
|
});
|
|
@@ -225,6 +225,59 @@ mcp.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
225
225
|
required: ["to", "url"],
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
|
+
{
|
|
229
|
+
name: "wahooks_send_video",
|
|
230
|
+
description: "Send a video via WhatsApp.",
|
|
231
|
+
inputSchema: {
|
|
232
|
+
type: "object",
|
|
233
|
+
properties: {
|
|
234
|
+
to: { type: "string", description: "Phone number" },
|
|
235
|
+
url: { type: "string", description: "Video URL" },
|
|
236
|
+
caption: { type: "string", description: "Optional caption" },
|
|
237
|
+
},
|
|
238
|
+
required: ["to", "url"],
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: "wahooks_send_audio",
|
|
243
|
+
description: "Send an audio/voice message via WhatsApp.",
|
|
244
|
+
inputSchema: {
|
|
245
|
+
type: "object",
|
|
246
|
+
properties: {
|
|
247
|
+
to: { type: "string", description: "Phone number" },
|
|
248
|
+
url: { type: "string", description: "Audio URL" },
|
|
249
|
+
},
|
|
250
|
+
required: ["to", "url"],
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
name: "wahooks_send_location",
|
|
255
|
+
description: "Send a location pin via WhatsApp.",
|
|
256
|
+
inputSchema: {
|
|
257
|
+
type: "object",
|
|
258
|
+
properties: {
|
|
259
|
+
to: { type: "string", description: "Phone number" },
|
|
260
|
+
latitude: { type: "number", description: "Latitude" },
|
|
261
|
+
longitude: { type: "number", description: "Longitude" },
|
|
262
|
+
name: { type: "string", description: "Location name" },
|
|
263
|
+
address: { type: "string", description: "Address" },
|
|
264
|
+
},
|
|
265
|
+
required: ["to", "latitude", "longitude"],
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
name: "wahooks_send_contact",
|
|
270
|
+
description: "Send a contact card via WhatsApp.",
|
|
271
|
+
inputSchema: {
|
|
272
|
+
type: "object",
|
|
273
|
+
properties: {
|
|
274
|
+
to: { type: "string", description: "Phone number" },
|
|
275
|
+
contact_name: { type: "string", description: "Contact's display name" },
|
|
276
|
+
contact_phone: { type: "string", description: "Contact's phone number" },
|
|
277
|
+
},
|
|
278
|
+
required: ["to", "contact_name", "contact_phone"],
|
|
279
|
+
},
|
|
280
|
+
},
|
|
228
281
|
],
|
|
229
282
|
}));
|
|
230
283
|
function toChatId(phone) {
|
|
@@ -258,6 +311,39 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
258
311
|
});
|
|
259
312
|
return { content: [{ type: "text", text: `Document sent to ${args.to}` }] };
|
|
260
313
|
}
|
|
314
|
+
case "wahooks_send_video": {
|
|
315
|
+
await api("POST", `/connections/${connectionId}/send-video`, {
|
|
316
|
+
chatId: toChatId(args.to),
|
|
317
|
+
url: args.url,
|
|
318
|
+
caption: args.caption,
|
|
319
|
+
});
|
|
320
|
+
return { content: [{ type: "text", text: `Video sent to ${args.to}` }] };
|
|
321
|
+
}
|
|
322
|
+
case "wahooks_send_audio": {
|
|
323
|
+
await api("POST", `/connections/${connectionId}/send-audio`, {
|
|
324
|
+
chatId: toChatId(args.to),
|
|
325
|
+
url: args.url,
|
|
326
|
+
});
|
|
327
|
+
return { content: [{ type: "text", text: `Audio sent to ${args.to}` }] };
|
|
328
|
+
}
|
|
329
|
+
case "wahooks_send_location": {
|
|
330
|
+
await api("POST", `/connections/${connectionId}/send-location`, {
|
|
331
|
+
chatId: toChatId(args.to),
|
|
332
|
+
latitude: parseFloat(args.latitude),
|
|
333
|
+
longitude: parseFloat(args.longitude),
|
|
334
|
+
name: args.name,
|
|
335
|
+
address: args.address,
|
|
336
|
+
});
|
|
337
|
+
return { content: [{ type: "text", text: `Location sent to ${args.to}` }] };
|
|
338
|
+
}
|
|
339
|
+
case "wahooks_send_contact": {
|
|
340
|
+
await api("POST", `/connections/${connectionId}/send-contact`, {
|
|
341
|
+
chatId: toChatId(args.to),
|
|
342
|
+
contactName: args.contact_name,
|
|
343
|
+
contactPhone: args.contact_phone,
|
|
344
|
+
});
|
|
345
|
+
return { content: [{ type: "text", text: `Contact sent to ${args.to}` }] };
|
|
346
|
+
}
|
|
261
347
|
default:
|
|
262
348
|
throw new Error(`Unknown tool: ${req.params.name}`);
|
|
263
349
|
}
|