@ziggs-ai/ziggs-mcp 0.1.28 → 0.1.29
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/tools.js +11 -2
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -475,13 +475,22 @@ export function registerZiggsTools(server, creds, cfg) {
|
|
|
475
475
|
.string()
|
|
476
476
|
.optional()
|
|
477
477
|
.describe('Usually "message" for user-visible chat'),
|
|
478
|
-
|
|
478
|
+
idempotencyKey: z
|
|
479
|
+
.string()
|
|
480
|
+
.optional()
|
|
481
|
+
.describe('Retry-safe key. Reuse the SAME key when re-sending the SAME logical message (e.g. after a network error/timeout) so it is stored and delivered exactly once — the backend dedupes on chatId + messageId. Use a fresh key (or omit) for a genuinely new message.'),
|
|
482
|
+
}, WRITE, async ({ chatId, receiverId, text, entryType, idempotencyKey }) => {
|
|
479
483
|
try {
|
|
480
484
|
const result = await sendChatMessage({
|
|
481
485
|
chatId,
|
|
482
486
|
receiverId,
|
|
483
487
|
text,
|
|
484
|
-
messageId
|
|
488
|
+
// A stable idempotencyKey maps to a stable messageId so a retried
|
|
489
|
+
// logical send collapses to one row/one delivery (ZIG-718 backend
|
|
490
|
+
// dedupe); otherwise each call is a distinct message.
|
|
491
|
+
messageId: idempotencyKey
|
|
492
|
+
? `mcp_idem_${idempotencyKey}`
|
|
493
|
+
: `mcp_${randomUUID()}`,
|
|
485
494
|
entryType: entryType ?? 'message',
|
|
486
495
|
contentType: 'text',
|
|
487
496
|
}, creds);
|