verdo-mcp 1.2.0 → 2.0.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/README.md CHANGED
@@ -3,10 +3,15 @@
3
3
  MCP server for [Verdo](https://verdo.ink) team decisions. Lets Claude Desktop,
4
4
  Claude Code, and other MCP clients propose team decisions and follow them.
5
5
 
6
- **The agent proposes, a person decides.** No tool invites people, sends
7
- notifications, or closes or settles a decision. A proposed decision opens in
8
- the workspace's Verdo dashboard with nobody invited; its owner shares the voter
9
- link with the team and makes the call there.
6
+ **The agent proposes, a person decides.** No tool invites people, or closes or
7
+ settles a decision. A proposed decision opens in the workspace's Verdo dashboard
8
+ with nobody invited; its owner shares the voter link with the team and makes the
9
+ call there. If its tags match a routing rule set up in Verdo, Verdo emails that
10
+ rule's approver and posts to the rule's channel (never for a draft-only key).
11
+
12
+ Limits are enforced by the Verdo API, not by this package: decisions created by
13
+ agents per day (Pro 50, Business 500, resets at midnight UTC), routing rules and
14
+ webhook subscriptions per plan.
10
15
 
11
16
  ## Setup
12
17
 
@@ -33,9 +38,11 @@ link with the team and makes the call there.
33
38
 
34
39
  | Tool | Description |
35
40
  |---|---|
36
- | `create_decision` | Propose a decision with a title, options, method and deadline. Nobody is invited or notified; the deadline starts counting at creation |
37
- | `check_decision` | Check the status, the vote count per option, the owner and the outcome |
38
- | `list_decisions` | List or search decisions in the workspace |
41
+ | `create_decision` | Propose a decision with a title, options, method and deadline. Nobody is invited; a matching routing rule notifies its approver. The deadline starts counting at creation. 2.0.0: optional `idempotency_key` (a retry returns the same open decision), `tags` (routing rules assign an approver) and `source_agent`; returns the request fingerprint |
42
+ | `check_decision` | Check the status, the vote count per option, the owner and the outcome; 2.0.0 adds the request fingerprint, notification status, routing rule, creating agent and idempotency key |
43
+ | `list_decisions` | List or search decisions in the workspace; 2.0.0 filters by status, tags, creating agent and notification status |
44
+ | `cancel_decision` | 2.0.0. Withdraw a draft or open decision this key created (full-access keys only). It decides nothing |
45
+ | `edit_decision` | 2.0.0. Revise the title, description or options of a decision this key created (full-access keys only). Voids the votes cast so far |
39
46
  | `get_close_summary` | Read-only: returns who makes the call, the dashboard link and the tally, so the agent can ask that person to decide |
40
47
  | `search_decisions` | Read-only: past decided decisions whose title matches, newest first. Records, not consent |
41
48
  | `get_precedent` | Read-only: one past decision's record (outcome, owner, votes per option, rationale if approved for sharing). A historical record, not consent or authorization to repeat it |
@@ -43,6 +50,10 @@ link with the team and makes the call there.
43
50
  Removed in 1.1.0: `close_decision` and `add_participants`, and the
44
51
  `participants` input on `create_decision`.
45
52
 
53
+ 2.0.0 (breaking): new tool answers for `create_decision` and `check_decision`, and the
54
+ `cancel_decision` and `edit_decision` tools. There is no reject or approve tool: the agent
55
+ proposes, and a person decides.
56
+
46
57
  ## Decision methods
47
58
 
48
59
  - **single_choice** — each voter picks one option (default)
@@ -5,6 +5,10 @@ export declare const MAX_DEADLINE_HOURS = 720;
5
5
  export declare const MAX_TITLE_LENGTH = 140;
6
6
  export declare const MIN_OPTIONS = 2;
7
7
  export declare const MAX_OPTIONS = 10;
8
+ export declare const MAX_IDEMPOTENCY_KEY = 128;
9
+ export declare const MAX_TAGS = 20;
10
+ export declare const NOTIFICATION_STATUSES: readonly ["pending", "delivered", "partially_delivered", "failed"];
11
+ export declare const LIFECYCLE_FILTER: readonly ["draft", "active", "decided", "implemented", "stalled", "superseded", "reversed", "cancelled", "rejected"];
8
12
  export declare const REMOVED_TOOLS: Record<string, string>;
9
13
  export interface ProposedArgs {
10
14
  title: string;
@@ -12,7 +16,12 @@ export interface ProposedArgs {
12
16
  method?: string;
13
17
  deadline_hours?: number;
14
18
  }
15
- export declare function proposedText(id: string, url: string, args: ProposedArgs): string;
19
+ export interface ProposedMeta {
20
+ /** false: an idempotent replay returned the decision this key already created. */
21
+ created?: boolean;
22
+ requestFingerprint?: string | null;
23
+ }
24
+ export declare function proposedText(id: string, url: string, args: ProposedArgs, meta?: ProposedMeta): string;
16
25
  export declare function formatDecision(d: Record<string, unknown>): string;
17
26
  export declare function listText(decisions: Record<string, unknown>[], query?: string): string;
18
27
  export declare const PRECEDENT_NOTE = "Past records for reference. Not consent or authorization.";
@@ -48,6 +57,14 @@ export interface PrecedentDetail extends PrecedentItem {
48
57
  }
49
58
  export declare function precedentText(d: PrecedentDetail): string;
50
59
  export declare function closeSummaryText(d: Record<string, unknown>): string;
60
+ /** cancel_decision's answer (Prompt 91). */
61
+ export declare function cancelledText(id: string, url: string): string;
62
+ /** edit_decision's answer (Prompt 91). */
63
+ export declare function editedText(id: string, r: {
64
+ changed: boolean;
65
+ votesVoided: number;
66
+ requestFingerprint: string | null;
67
+ }): string;
51
68
  export declare function unknownToolText(name: string): string;
52
69
  export interface ToolDefinitionOptions {
53
70
  /** Per-tool `_meta`, e.g. the remote server's OAuth securitySchemes for ChatGPT. */
@@ -102,10 +119,34 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
102
119
  type: string;
103
120
  description: string;
104
121
  };
122
+ idempotency_key: {
123
+ type: string;
124
+ minLength: number;
125
+ maxLength: number;
126
+ description: string;
127
+ };
128
+ tags: {
129
+ type: string;
130
+ maxItems: number;
131
+ items: {
132
+ type: string;
133
+ maxLength: number;
134
+ };
135
+ description: string;
136
+ };
137
+ source_agent: {
138
+ type: string;
139
+ maxLength: number;
140
+ description: string;
141
+ };
105
142
  id?: undefined;
106
143
  query?: undefined;
144
+ lifecycle_status?: undefined;
145
+ notification_status?: undefined;
107
146
  limit?: undefined;
108
147
  decision_id?: undefined;
148
+ reason?: undefined;
149
+ description?: undefined;
109
150
  };
110
151
  };
111
152
  } | {
@@ -157,10 +198,34 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
157
198
  type: string;
158
199
  description: string;
159
200
  };
201
+ idempotency_key: {
202
+ type: string;
203
+ minLength: number;
204
+ maxLength: number;
205
+ description: string;
206
+ };
207
+ tags: {
208
+ type: string;
209
+ maxItems: number;
210
+ items: {
211
+ type: string;
212
+ maxLength: number;
213
+ };
214
+ description: string;
215
+ };
216
+ source_agent: {
217
+ type: string;
218
+ maxLength: number;
219
+ description: string;
220
+ };
160
221
  id?: undefined;
161
222
  query?: undefined;
223
+ lifecycle_status?: undefined;
224
+ notification_status?: undefined;
162
225
  limit?: undefined;
163
226
  decision_id?: undefined;
227
+ reason?: undefined;
228
+ description?: undefined;
164
229
  };
165
230
  };
166
231
  } | {
@@ -189,9 +254,16 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
189
254
  deadline_hours?: undefined;
190
255
  authority_mode?: undefined;
191
256
  anonymous?: undefined;
257
+ idempotency_key?: undefined;
258
+ tags?: undefined;
259
+ source_agent?: undefined;
192
260
  query?: undefined;
261
+ lifecycle_status?: undefined;
262
+ notification_status?: undefined;
193
263
  limit?: undefined;
194
264
  decision_id?: undefined;
265
+ reason?: undefined;
266
+ description?: undefined;
195
267
  };
196
268
  };
197
269
  } | {
@@ -220,9 +292,16 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
220
292
  deadline_hours?: undefined;
221
293
  authority_mode?: undefined;
222
294
  anonymous?: undefined;
295
+ idempotency_key?: undefined;
296
+ tags?: undefined;
297
+ source_agent?: undefined;
223
298
  query?: undefined;
299
+ lifecycle_status?: undefined;
300
+ notification_status?: undefined;
224
301
  limit?: undefined;
225
302
  decision_id?: undefined;
303
+ reason?: undefined;
304
+ description?: undefined;
226
305
  };
227
306
  };
228
307
  } | {
@@ -244,15 +323,45 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
244
323
  description: string;
245
324
  maxLength?: undefined;
246
325
  };
326
+ lifecycle_status: {
327
+ type: string;
328
+ items: {
329
+ type: string;
330
+ enum: ("draft" | "active" | "decided" | "implemented" | "stalled" | "superseded" | "reversed" | "cancelled" | "rejected")[];
331
+ };
332
+ description: string;
333
+ };
334
+ tags: {
335
+ type: string;
336
+ maxItems: number;
337
+ items: {
338
+ type: string;
339
+ maxLength?: undefined;
340
+ };
341
+ description: string;
342
+ };
343
+ source_agent: {
344
+ type: string;
345
+ description: string;
346
+ maxLength?: undefined;
347
+ };
348
+ notification_status: {
349
+ type: string;
350
+ enum: ("pending" | "delivered" | "partially_delivered" | "failed")[];
351
+ description: string;
352
+ };
247
353
  title?: undefined;
248
354
  options?: undefined;
249
355
  method?: undefined;
250
356
  deadline_hours?: undefined;
251
357
  authority_mode?: undefined;
252
358
  anonymous?: undefined;
359
+ idempotency_key?: undefined;
253
360
  id?: undefined;
254
361
  limit?: undefined;
255
362
  decision_id?: undefined;
363
+ reason?: undefined;
364
+ description?: undefined;
256
365
  };
257
366
  required?: undefined;
258
367
  };
@@ -275,15 +384,45 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
275
384
  description: string;
276
385
  maxLength?: undefined;
277
386
  };
387
+ lifecycle_status: {
388
+ type: string;
389
+ items: {
390
+ type: string;
391
+ enum: ("draft" | "active" | "decided" | "implemented" | "stalled" | "superseded" | "reversed" | "cancelled" | "rejected")[];
392
+ };
393
+ description: string;
394
+ };
395
+ tags: {
396
+ type: string;
397
+ maxItems: number;
398
+ items: {
399
+ type: string;
400
+ maxLength?: undefined;
401
+ };
402
+ description: string;
403
+ };
404
+ source_agent: {
405
+ type: string;
406
+ description: string;
407
+ maxLength?: undefined;
408
+ };
409
+ notification_status: {
410
+ type: string;
411
+ enum: ("pending" | "delivered" | "partially_delivered" | "failed")[];
412
+ description: string;
413
+ };
278
414
  title?: undefined;
279
415
  options?: undefined;
280
416
  method?: undefined;
281
417
  deadline_hours?: undefined;
282
418
  authority_mode?: undefined;
283
419
  anonymous?: undefined;
420
+ idempotency_key?: undefined;
284
421
  id?: undefined;
285
422
  limit?: undefined;
286
423
  decision_id?: undefined;
424
+ reason?: undefined;
425
+ description?: undefined;
287
426
  };
288
427
  required?: undefined;
289
428
  };
@@ -319,8 +458,15 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
319
458
  deadline_hours?: undefined;
320
459
  authority_mode?: undefined;
321
460
  anonymous?: undefined;
461
+ idempotency_key?: undefined;
462
+ tags?: undefined;
463
+ source_agent?: undefined;
322
464
  id?: undefined;
465
+ lifecycle_status?: undefined;
466
+ notification_status?: undefined;
323
467
  decision_id?: undefined;
468
+ reason?: undefined;
469
+ description?: undefined;
324
470
  };
325
471
  };
326
472
  } | {
@@ -355,8 +501,15 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
355
501
  deadline_hours?: undefined;
356
502
  authority_mode?: undefined;
357
503
  anonymous?: undefined;
504
+ idempotency_key?: undefined;
505
+ tags?: undefined;
506
+ source_agent?: undefined;
358
507
  id?: undefined;
508
+ lifecycle_status?: undefined;
509
+ notification_status?: undefined;
359
510
  decision_id?: undefined;
511
+ reason?: undefined;
512
+ description?: undefined;
360
513
  };
361
514
  };
362
515
  } | {
@@ -385,9 +538,16 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
385
538
  deadline_hours?: undefined;
386
539
  authority_mode?: undefined;
387
540
  anonymous?: undefined;
541
+ idempotency_key?: undefined;
542
+ tags?: undefined;
543
+ source_agent?: undefined;
388
544
  id?: undefined;
389
545
  query?: undefined;
546
+ lifecycle_status?: undefined;
547
+ notification_status?: undefined;
390
548
  limit?: undefined;
549
+ reason?: undefined;
550
+ description?: undefined;
391
551
  };
392
552
  };
393
553
  } | {
@@ -416,9 +576,206 @@ export declare function toolDefinitions(opts?: ToolDefinitionOptions): ({
416
576
  deadline_hours?: undefined;
417
577
  authority_mode?: undefined;
418
578
  anonymous?: undefined;
579
+ idempotency_key?: undefined;
580
+ tags?: undefined;
581
+ source_agent?: undefined;
582
+ id?: undefined;
583
+ query?: undefined;
584
+ lifecycle_status?: undefined;
585
+ notification_status?: undefined;
586
+ limit?: undefined;
587
+ reason?: undefined;
588
+ description?: undefined;
589
+ };
590
+ };
591
+ } | {
592
+ _meta: Record<string, unknown>;
593
+ name: string;
594
+ description: string;
595
+ annotations: {
596
+ title: string;
597
+ readOnlyHint: boolean;
598
+ destructiveHint: boolean;
599
+ idempotentHint: boolean;
600
+ openWorldHint: boolean;
601
+ };
602
+ inputSchema: {
603
+ type: "object";
604
+ required: string[];
605
+ properties: {
606
+ decision_id: {
607
+ type: string;
608
+ format: string;
609
+ description: string;
610
+ };
611
+ reason: {
612
+ type: string;
613
+ maxLength: number;
614
+ description: string;
615
+ };
616
+ title?: undefined;
617
+ options?: undefined;
618
+ method?: undefined;
619
+ deadline_hours?: undefined;
620
+ authority_mode?: undefined;
621
+ anonymous?: undefined;
622
+ idempotency_key?: undefined;
623
+ tags?: undefined;
624
+ source_agent?: undefined;
625
+ id?: undefined;
626
+ query?: undefined;
627
+ lifecycle_status?: undefined;
628
+ notification_status?: undefined;
629
+ limit?: undefined;
630
+ description?: undefined;
631
+ };
632
+ };
633
+ } | {
634
+ _meta?: undefined;
635
+ name: string;
636
+ description: string;
637
+ annotations: {
638
+ title: string;
639
+ readOnlyHint: boolean;
640
+ destructiveHint: boolean;
641
+ idempotentHint: boolean;
642
+ openWorldHint: boolean;
643
+ };
644
+ inputSchema: {
645
+ type: "object";
646
+ required: string[];
647
+ properties: {
648
+ decision_id: {
649
+ type: string;
650
+ format: string;
651
+ description: string;
652
+ };
653
+ reason: {
654
+ type: string;
655
+ maxLength: number;
656
+ description: string;
657
+ };
658
+ title?: undefined;
659
+ options?: undefined;
660
+ method?: undefined;
661
+ deadline_hours?: undefined;
662
+ authority_mode?: undefined;
663
+ anonymous?: undefined;
664
+ idempotency_key?: undefined;
665
+ tags?: undefined;
666
+ source_agent?: undefined;
667
+ id?: undefined;
668
+ query?: undefined;
669
+ lifecycle_status?: undefined;
670
+ notification_status?: undefined;
671
+ limit?: undefined;
672
+ description?: undefined;
673
+ };
674
+ };
675
+ } | {
676
+ _meta: Record<string, unknown>;
677
+ name: string;
678
+ description: string;
679
+ annotations: {
680
+ title: string;
681
+ readOnlyHint: boolean;
682
+ destructiveHint: boolean;
683
+ idempotentHint: boolean;
684
+ openWorldHint: boolean;
685
+ };
686
+ inputSchema: {
687
+ type: "object";
688
+ required: string[];
689
+ properties: {
690
+ decision_id: {
691
+ type: string;
692
+ format: string;
693
+ description: string;
694
+ };
695
+ title: {
696
+ type: string;
697
+ maxLength: number;
698
+ description: string;
699
+ };
700
+ description: {
701
+ type: string;
702
+ description: string;
703
+ };
704
+ options: {
705
+ type: string;
706
+ minItems: number;
707
+ maxItems: number;
708
+ items: {
709
+ type: string;
710
+ };
711
+ description: string;
712
+ };
713
+ method?: undefined;
714
+ deadline_hours?: undefined;
715
+ authority_mode?: undefined;
716
+ anonymous?: undefined;
717
+ idempotency_key?: undefined;
718
+ tags?: undefined;
719
+ source_agent?: undefined;
720
+ id?: undefined;
721
+ query?: undefined;
722
+ lifecycle_status?: undefined;
723
+ notification_status?: undefined;
724
+ limit?: undefined;
725
+ reason?: undefined;
726
+ };
727
+ };
728
+ } | {
729
+ _meta?: undefined;
730
+ name: string;
731
+ description: string;
732
+ annotations: {
733
+ title: string;
734
+ readOnlyHint: boolean;
735
+ destructiveHint: boolean;
736
+ idempotentHint: boolean;
737
+ openWorldHint: boolean;
738
+ };
739
+ inputSchema: {
740
+ type: "object";
741
+ required: string[];
742
+ properties: {
743
+ decision_id: {
744
+ type: string;
745
+ format: string;
746
+ description: string;
747
+ };
748
+ title: {
749
+ type: string;
750
+ maxLength: number;
751
+ description: string;
752
+ };
753
+ description: {
754
+ type: string;
755
+ description: string;
756
+ };
757
+ options: {
758
+ type: string;
759
+ minItems: number;
760
+ maxItems: number;
761
+ items: {
762
+ type: string;
763
+ };
764
+ description: string;
765
+ };
766
+ method?: undefined;
767
+ deadline_hours?: undefined;
768
+ authority_mode?: undefined;
769
+ anonymous?: undefined;
770
+ idempotency_key?: undefined;
771
+ tags?: undefined;
772
+ source_agent?: undefined;
419
773
  id?: undefined;
420
774
  query?: undefined;
775
+ lifecycle_status?: undefined;
776
+ notification_status?: undefined;
421
777
  limit?: undefined;
778
+ reason?: undefined;
422
779
  };
423
780
  };
424
781
  })[];
@@ -3,9 +3,13 @@
3
3
  // server at verdo.ink/api/mcp (in-process). Pure: no fetch, no environment, no imports,
4
4
  // so the remote server can import it without pulling in the stdio runtime.
5
5
  //
6
- // Guardrail: the agent proposes, a person decides. No tool invites, notifies, settles,
7
- // closes or cancels. create_decision is the only write, and it sends no participants;
8
- // get_close_summary only reads and points the agent at a person.
6
+ // Guardrail: the agent proposes, a person decides. No tool invites, settles or picks an
7
+ // outcome. No tool sends a notice of its own: a routing rule a person configured may (P93:
8
+ // the rule's approver by email, the rule's channel), never for a draft-only key. Writes (2.0.0): create_decision (proposes; sends no participants), and,
9
+ // for the request the caller created, cancel_decision (withdraw it) and edit_decision (revise
10
+ // it; voids votes). There is no reject or approve tool: rejecting is the human approver's call
11
+ // (Alex, 2026-11-25: AI boundary, Prompt 63). get_close_summary only reads and points the agent
12
+ // at a person.
9
13
  // Values the API accepts (DB checks in migrations 0041 and 0042). Owner and approver
10
14
  // modes need a named person, which this API cannot set, so they are not offered.
11
15
  export const METHODS = ["single_choice", "ranked_choice", "approval", "dot"];
@@ -15,23 +19,29 @@ export const MAX_DEADLINE_HOURS = 720;
15
19
  export const MAX_TITLE_LENGTH = 140;
16
20
  export const MIN_OPTIONS = 2;
17
21
  export const MAX_OPTIONS = 10;
22
+ export const MAX_IDEMPOTENCY_KEY = 128;
23
+ export const MAX_TAGS = 20;
24
+ export const NOTIFICATION_STATUSES = ["pending", "delivered", "partially_delivered", "failed"];
25
+ export const LIFECYCLE_FILTER = ["draft", "active", "decided", "implemented", "stalled", "superseded", "reversed", "cancelled", "rejected"];
18
26
  export const REMOVED_TOOLS = {
19
27
  close_decision: "close_decision was removed in 1.1.0: agents cannot close decisions. Use get_close_summary to find out who makes the call.",
20
28
  add_participants: "add_participants was removed in 1.1.0: agents cannot invite people. Send the dashboard link to the decision's owner; they share the voter link.",
21
29
  request_close: "request_close was renamed get_close_summary: the same read-only tool. Use get_close_summary.",
22
30
  };
23
- export function proposedText(id, url, args) {
31
+ export function proposedText(id, url, args, meta = {}) {
32
+ const replay = meta.created === false;
24
33
  return [
25
- `Decision proposed.`,
34
+ replay ? `Existing decision returned (same idempotency_key; nothing new was created).` : `Decision proposed.`,
26
35
  ``,
27
36
  `ID: ${id}`,
37
+ ...(meta.requestFingerprint ? [`Request fingerprint: ${meta.requestFingerprint}`] : []),
28
38
  `Dashboard: ${url}`,
29
39
  `Title: ${args.title}`,
30
40
  `Options: ${args.options.join(", ")}`,
31
41
  `Method: ${args.method ?? "single_choice"}`,
32
42
  `Deadline: ${args.deadline_hours ?? DEFAULT_DEADLINE_HOURS} hours from now`,
33
43
  ``,
34
- `Nobody has been invited or notified. Send the dashboard link to the person who owns this decision: they share the voter link with the team and make the call.`,
44
+ `Nobody has been invited. If its tags matched a routing rule, Verdo has told that rule's approver; otherwise send the dashboard link to the person who owns this decision: they share the voter link with the team and make the call.`,
35
45
  `Use check_decision with id "${id}" to see progress.`,
36
46
  ].join("\n");
37
47
  }
@@ -48,6 +58,18 @@ export function formatDecision(d) {
48
58
  // Record lite (Prompt 62): present only when approved for external sharing.
49
59
  if (typeof d.rationale === "string" && d.rationale)
50
60
  lines.push(`Rationale: ${d.rationale}`);
61
+ // Prompt 88: what the outcome is bound to. Compare with the fingerprint create_decision returned.
62
+ if (typeof d.request_fingerprint === "string" && d.request_fingerprint)
63
+ lines.push(`Request fingerprint: ${d.request_fingerprint}`);
64
+ // Prompt 91: the agent-layer fields.
65
+ if (typeof d.notification_status === "string" && d.notification_status)
66
+ lines.push(`Notification status: ${d.notification_status}`);
67
+ if (typeof d.routing_rule_label === "string" && d.routing_rule_label)
68
+ lines.push(`Routing rule: ${d.routing_rule_label}`);
69
+ if (typeof d.source_agent === "string" && d.source_agent)
70
+ lines.push(`Created by agent: ${d.source_agent}`);
71
+ if (typeof d.idempotency_key === "string" && d.idempotency_key)
72
+ lines.push(`Idempotency key: ${d.idempotency_key}`);
51
73
  const breakdown = d.vote_breakdown;
52
74
  if (breakdown?.length) {
53
75
  lines.push(``, `Options:`);
@@ -136,6 +158,22 @@ export function closeSummaryText(d) {
136
158
  formatDecision(d),
137
159
  ].join("\n");
138
160
  }
161
+ /** cancel_decision's answer (Prompt 91). */
162
+ export function cancelledText(id, url) {
163
+ return [`Decision cancelled.`, ``, `ID: ${id}`, `Dashboard: ${url}`, `It is closed for good. Anyone it was sent to sees it was withdrawn.`].join("\n");
164
+ }
165
+ /** edit_decision's answer (Prompt 91). */
166
+ export function editedText(id, r) {
167
+ if (!r.changed)
168
+ return [`Nothing changed: the title, description and options are as they were.`, `ID: ${id}`].join("\n");
169
+ return [
170
+ `Decision updated.`,
171
+ ``,
172
+ `ID: ${id}`,
173
+ `New request fingerprint: ${r.requestFingerprint ?? "(none)"}`,
174
+ `Votes voided: ${r.votesVoided}. Everyone who had voted approved the old version and is asked again.`,
175
+ ].join("\n");
176
+ }
139
177
  export function unknownToolText(name) {
140
178
  const tools = toolDefinitions().map((t) => t.name).join(", ");
141
179
  return `${REMOVED_TOOLS[name] ?? `Unknown tool: ${name}.`} Available tools: ${tools}.`;
@@ -145,7 +183,7 @@ export function toolDefinitions(opts = {}) {
145
183
  return [
146
184
  {
147
185
  name: "create_decision",
148
- description: "Propose a team decision in the user's Verdo workspace. The agent proposes; a person decides. Nobody is invited or notified: the decision opens in the workspace's dashboard, where its owner shares the voter link and makes the call. The deadline starts counting when it is created. Returns the decision ID and the dashboard link to send to that person, and up to 3 previously decided decisions with a similar title: past records for reference, not consent or authorization.",
186
+ description: "Propose a team decision in the user's Verdo workspace. The agent proposes; a person decides. It invites nobody: the decision opens in the workspace's dashboard, where its owner shares the voter link and makes the call. Tags can route it to an approver configured in Verdo; a routing rule then emails that approver and posts to the rule's channel (not with a draft-only key). The deadline starts counting when it is created. Returns the decision ID, its request fingerprint, the dashboard link to send to that person, and up to 3 previously decided decisions with a similar title: past records for reference, not consent or authorization. With an idempotency_key, a retry returns the same decision instead of creating a second one.",
149
187
  annotations: {
150
188
  title: "Propose Decision",
151
189
  readOnlyHint: false,
@@ -185,13 +223,30 @@ export function toolDefinitions(opts = {}) {
185
223
  type: "boolean",
186
224
  description: "Whether votes are anonymous. Default: false",
187
225
  },
226
+ idempotency_key: {
227
+ type: "string",
228
+ minLength: 1,
229
+ maxLength: MAX_IDEMPOTENCY_KEY,
230
+ description: "Optional. Retry safety: while the decision this key created is still open, the same key returns it instead of creating another. Case-sensitive, up to 128 characters.",
231
+ },
232
+ tags: {
233
+ type: "array",
234
+ maxItems: MAX_TAGS,
235
+ items: { type: "string", maxLength: 50 },
236
+ description: "Optional. Tags for the decision; a workspace routing rule matching one of them assigns its approver.",
237
+ },
238
+ source_agent: {
239
+ type: "string",
240
+ maxLength: 200,
241
+ description: "Optional. A name for the agent creating this, recorded on the decision. Default: the API key's name or the connected app.",
242
+ },
188
243
  },
189
244
  },
190
245
  ...meta,
191
246
  },
192
247
  {
193
248
  name: "check_decision",
194
- description: "Check the status, votes and outcome of a Verdo decision. Returns the status, the vote count per option, the owner if one is named, the outcome once a person has decided, and the dashboard link.",
249
+ description: "Check the status, votes and outcome of a Verdo decision. Returns the status, the vote count per option, the owner if one is named, the outcome once a person has decided, the dashboard link, and its request fingerprint (compare it with the one create_decision returned), notification status, routing rule, creating agent and idempotency key.",
195
250
  annotations: {
196
251
  title: "Check Decision",
197
252
  readOnlyHint: true,
@@ -210,7 +265,7 @@ export function toolDefinitions(opts = {}) {
210
265
  },
211
266
  {
212
267
  name: "list_decisions",
213
- description: "List or search decisions in the workspace. Returns up to 25 decisions with their status and title. Use the query parameter to search by title.",
268
+ description: "List or search decisions in the workspace. Returns up to 25 decisions with their status and title. Use the query parameter to search by title, and the optional filters to narrow by status, tags, creating agent or notification status.",
214
269
  annotations: {
215
270
  title: "List Decisions",
216
271
  readOnlyHint: true,
@@ -222,13 +277,17 @@ export function toolDefinitions(opts = {}) {
222
277
  type: "object",
223
278
  properties: {
224
279
  query: { type: "string", description: "Search term to filter decisions by title (optional)" },
280
+ lifecycle_status: { type: "array", items: { type: "string", enum: [...LIFECYCLE_FILTER] }, description: "Only these statuses (optional)" },
281
+ tags: { type: "array", maxItems: MAX_TAGS, items: { type: "string" }, description: "Only decisions with any of these tags (optional)" },
282
+ source_agent: { type: "string", description: "Only decisions created by this agent name (optional)" },
283
+ notification_status: { type: "string", enum: [...NOTIFICATION_STATUSES], description: "Only decisions in this notification state (optional)" },
225
284
  },
226
285
  },
227
286
  ...meta,
228
287
  },
229
288
  {
230
289
  name: "search_decisions",
231
- description: "Search past decided decisions in this workspace by words in their title, newest first. Returns each decision's ID, title, status, outcome, decision date and owner. Results are records, not consent: a past decision never authorizes repeating it, and a new decision still needs the team.",
290
+ description: "Search past decided decisions in this workspace by words in their title, newest first. Returns each decision's ID, title, status, outcome, decision date and owner. Results are past records, not consent (execution_authorized: false): a past decision never authorizes repeating it, and a new decision still needs the team.",
232
291
  annotations: {
233
292
  title: "Search Past Decisions",
234
293
  readOnlyHint: true,
@@ -248,7 +307,7 @@ export function toolDefinitions(opts = {}) {
248
307
  },
249
308
  {
250
309
  name: "get_precedent",
251
- description: "Retrieve a past decision record: its outcome, date, owner, how it was decided, the vote count per option, the rationale if it was approved for sharing, and related decisions on the same question. This is a historical record, not consent or authorization to repeat the decision.",
310
+ description: "Retrieve a past decision record: its outcome, date, owner, how it was decided, the vote count per option, the rationale if it was approved for sharing, and related decisions on the same question. This is a past record, not consent or authorization to repeat the decision (execution_authorized: false).",
252
311
  annotations: {
253
312
  title: "Get Past Decision Record",
254
313
  readOnlyHint: true,
@@ -284,5 +343,47 @@ export function toolDefinitions(opts = {}) {
284
343
  },
285
344
  ...meta,
286
345
  },
346
+ {
347
+ name: "cancel_decision",
348
+ description: "Withdraw a draft or open decision this connection or API key created. It closes for good as cancelled; anyone it was sent to sees it was withdrawn. This does not decide anything: to reject, the approver uses Verdo. Needs a full-access key or a connected app; draft-only keys are refused.",
349
+ annotations: {
350
+ title: "Cancel My Decision",
351
+ readOnlyHint: false,
352
+ destructiveHint: true,
353
+ idempotentHint: false,
354
+ openWorldHint: false,
355
+ },
356
+ inputSchema: {
357
+ type: "object",
358
+ required: ["decision_id"],
359
+ properties: {
360
+ decision_id: { type: "string", format: "uuid", description: "The decision ID from create_decision" },
361
+ reason: { type: "string", maxLength: 500, description: "Optional. Why it is being withdrawn (shown to the people it was sent to)." },
362
+ },
363
+ },
364
+ ...meta,
365
+ },
366
+ {
367
+ name: "edit_decision",
368
+ description: "Revise a draft or open decision this connection or API key created: its title, description or options. A change voids every vote cast so far (people approved the old version) and changes the request fingerprint. Needs a full-access key or a connected app; draft-only keys are refused.",
369
+ annotations: {
370
+ title: "Edit My Decision",
371
+ readOnlyHint: false,
372
+ destructiveHint: true,
373
+ idempotentHint: true,
374
+ openWorldHint: false,
375
+ },
376
+ inputSchema: {
377
+ type: "object",
378
+ required: ["decision_id"],
379
+ properties: {
380
+ decision_id: { type: "string", format: "uuid", description: "The decision ID from create_decision" },
381
+ title: { type: "string", maxLength: MAX_TITLE_LENGTH, description: "New question (optional)" },
382
+ description: { type: "string", description: "New description (optional)" },
383
+ options: { type: "array", minItems: MIN_OPTIONS, maxItems: MAX_OPTIONS, items: { type: "string" }, description: "The full new list of options (optional)" },
384
+ },
385
+ },
386
+ ...meta,
387
+ },
287
388
  ];
288
389
  }
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ const keyStore = {
29
29
  }
30
30
  },
31
31
  };
32
- const server = new Server({ name: "verdo-team-decisions", version: "1.2.0" }, { capabilities: { tools: {} } });
32
+ const server = new Server({ name: "verdo-team-decisions", version: "2.0.0" }, { capabilities: { tools: {} } });
33
33
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
34
34
  tools: toolDefinitions(),
35
35
  }));
package/dist/tools.d.ts CHANGED
@@ -17,6 +17,9 @@ export declare function createDecision(args: {
17
17
  deadline_hours?: number;
18
18
  authority_mode?: string;
19
19
  anonymous?: boolean;
20
+ idempotency_key?: string;
21
+ tags?: string[];
22
+ source_agent?: string;
20
23
  }, store: ApiKeyStore): Promise<Text>;
21
24
  export declare function searchDecisions(args: {
22
25
  query: string;
@@ -30,8 +33,22 @@ export declare function checkDecision(args: {
30
33
  }, store: ApiKeyStore): Promise<Text>;
31
34
  export declare function listDecisions(args: {
32
35
  query?: string;
36
+ lifecycle_status?: string[];
37
+ tags?: string[];
38
+ source_agent?: string;
39
+ notification_status?: string;
33
40
  }, store: ApiKeyStore): Promise<Text>;
34
41
  export declare function getCloseSummary(args: {
35
42
  id: string;
36
43
  }, store: ApiKeyStore): Promise<Text>;
44
+ export declare function cancelDecision(args: {
45
+ decision_id: string;
46
+ reason?: string;
47
+ }, store: ApiKeyStore): Promise<Text>;
48
+ export declare function editDecision(args: {
49
+ decision_id: string;
50
+ title?: string;
51
+ description?: string;
52
+ options?: string[];
53
+ }, store: ApiKeyStore): Promise<Text>;
37
54
  export declare function callTool(name: string, a: Record<string, unknown>, store: ApiKeyStore): Promise<Text>;
package/dist/tools.js CHANGED
@@ -3,10 +3,11 @@
3
3
  // The definitions and the text each tool returns live in definitions.ts, shared with
4
4
  // the remote server at verdo.ink/api/mcp.
5
5
  //
6
- // Guardrail: the agent proposes, a person decides. No tool here invites, notifies,
7
- // settles, closes or cancels. create_decision is the only write, and it sends no
8
- // participants; get_close_summary only reads and points the agent at a person.
9
- import { AUTHORITY_MODES, DEFAULT_DEADLINE_HOURS, METHODS, formatDecision, listText, proposedText, closeSummaryText, toolDefinitions, unknownToolText, precedentSection, precedentText, searchText, } from "./definitions.js";
6
+ // Guardrail: the agent proposes, a person decides. No tool here invites, notifies, settles
7
+ // or picks an outcome. Writes (2.0.0): create_decision (sends no participants), and, for the
8
+ // caller's own request, cancel_decision and edit_decision (/api/v1/decisions/{id}/...). There
9
+ // is no reject tool: rejecting is the human approver's call. get_close_summary only reads.
10
+ import { AUTHORITY_MODES, DEFAULT_DEADLINE_HOURS, METHODS, formatDecision, listText, proposedText, cancelledText, editedText, closeSummaryText, toolDefinitions, unknownToolText, precedentSection, precedentText, searchText, } from "./definitions.js";
10
11
  export { AUTHORITY_MODES, METHODS, toolDefinitions };
11
12
  const VERDO_API = process.env.VERDO_API_URL ?? "https://verdo.ink/api";
12
13
  const text = (t, isError = false) => ({
@@ -57,10 +58,17 @@ export async function createDecision(args, store) {
57
58
  deadline_hours: args.deadline_hours ?? DEFAULT_DEADLINE_HOURS,
58
59
  authority_mode: args.authority_mode ?? "majority",
59
60
  anonymous: args.anonymous ?? false,
61
+ ...(args.idempotency_key !== undefined ? { idempotency_key: args.idempotency_key } : {}),
62
+ ...(args.tags !== undefined ? { tags: args.tags } : {}),
63
+ ...(args.source_agent !== undefined ? { source_agent: args.source_agent } : {}),
60
64
  }),
61
65
  });
62
66
  if (!ok)
63
67
  return agentError("create the decision", status, data);
68
+ const meta = { created: data.created !== false, requestFingerprint: typeof data.request_fingerprint === "string" ? data.request_fingerprint : null };
69
+ // A replay (same idempotency_key, decision still open): nothing new to look up.
70
+ if (!meta.created)
71
+ return text(proposedText(String(data.id), String(data.url), args, meta));
64
72
  // Prompt 64: up to 3 previously decided decisions with a similar title (reference only;
65
73
  // a failed lookup never fails the create).
66
74
  let precedent = [];
@@ -72,7 +80,7 @@ export async function createDecision(args, store) {
72
80
  catch {
73
81
  precedent = [];
74
82
  }
75
- return text(proposedText(String(data.id), String(data.url), args) + precedentSection(precedent));
83
+ return text(proposedText(String(data.id), String(data.url), args, meta) + precedentSection(precedent));
76
84
  }
77
85
  // Read-only. Past decided decisions, newest first: records, never consent.
78
86
  export async function searchDecisions(args, store) {
@@ -117,7 +125,18 @@ export async function listDecisions(args, store) {
117
125
  const apiKey = await store.get();
118
126
  if (!apiKey)
119
127
  return noKeyError();
120
- const qs = args.query ? `?query=${encodeURIComponent(args.query)}` : "";
128
+ const params = new URLSearchParams();
129
+ if (args.query)
130
+ params.set("query", args.query);
131
+ if (args.lifecycle_status?.length)
132
+ params.set("lifecycle_status", args.lifecycle_status.join(","));
133
+ if (args.tags?.length)
134
+ params.set("tags", args.tags.join(","));
135
+ if (args.source_agent)
136
+ params.set("source_agent", args.source_agent);
137
+ if (args.notification_status)
138
+ params.set("notification_status", args.notification_status);
139
+ const qs = params.toString() ? `?${params.toString()}` : "";
121
140
  const { ok, status, data } = await verdoFetch(`/zapier/decisions/search${qs}`, apiKey);
122
141
  if (!ok)
123
142
  return agentError("list decisions", status, data);
@@ -137,6 +156,34 @@ export async function getCloseSummary(args, store) {
137
156
  return text("Decision data not available.", true);
138
157
  return text(closeSummaryText(d));
139
158
  }
159
+ // 2.0.0. Withdraw the caller's own draft or open decision. Full-access keys only.
160
+ export async function cancelDecision(args, store) {
161
+ const apiKey = await store.get();
162
+ if (!apiKey)
163
+ return noKeyError();
164
+ const { ok, status, data } = await verdoFetch(`/v1/decisions/${encodeURIComponent(args.decision_id)}/cancel`, apiKey, {
165
+ method: "POST",
166
+ body: JSON.stringify(args.reason !== undefined ? { reason: args.reason } : {}),
167
+ });
168
+ if (!ok)
169
+ return agentError("cancel the decision", status, data);
170
+ return text(cancelledText(args.decision_id, `${VERDO_API.replace(/\/api$/, "")}/dashboard/d/${args.decision_id}`));
171
+ }
172
+ // 2.0.0. Revise the caller's own draft or open decision. A change voids the votes cast so far.
173
+ export async function editDecision(args, store) {
174
+ const apiKey = await store.get();
175
+ if (!apiKey)
176
+ return noKeyError();
177
+ const { decision_id, ...edit } = args;
178
+ const { ok, status, data } = await verdoFetch(`/v1/decisions/${encodeURIComponent(decision_id)}/edit`, apiKey, { method: "POST", body: JSON.stringify(edit) });
179
+ if (!ok)
180
+ return agentError("edit the decision", status, data);
181
+ return text(editedText(decision_id, {
182
+ changed: data.changed === true,
183
+ votesVoided: typeof data.votes_voided === "number" ? data.votes_voided : 0,
184
+ requestFingerprint: typeof data.request_fingerprint === "string" ? data.request_fingerprint : null,
185
+ }));
186
+ }
140
187
  // ---- Dispatch ----
141
188
  export async function callTool(name, a, store) {
142
189
  switch (name) {
@@ -148,17 +195,35 @@ export async function callTool(name, a, store) {
148
195
  deadline_hours: a.deadline_hours,
149
196
  authority_mode: a.authority_mode,
150
197
  anonymous: a.anonymous,
198
+ idempotency_key: a.idempotency_key,
199
+ tags: a.tags,
200
+ source_agent: a.source_agent,
151
201
  }, store);
152
202
  case "check_decision":
153
203
  return checkDecision({ id: String(a.id ?? "") }, store);
154
204
  case "list_decisions":
155
- return listDecisions({ query: a.query }, store);
205
+ return listDecisions({
206
+ query: a.query,
207
+ lifecycle_status: a.lifecycle_status,
208
+ tags: a.tags,
209
+ source_agent: a.source_agent,
210
+ notification_status: a.notification_status,
211
+ }, store);
156
212
  case "get_close_summary":
157
213
  return getCloseSummary({ id: String(a.id ?? "") }, store);
158
214
  case "search_decisions":
159
215
  return searchDecisions({ query: String(a.query ?? ""), limit: a.limit }, store);
160
216
  case "get_precedent":
161
217
  return getPrecedent({ decision_id: String(a.decision_id ?? "") }, store);
218
+ case "cancel_decision":
219
+ return cancelDecision({ decision_id: String(a.decision_id ?? ""), reason: a.reason }, store);
220
+ case "edit_decision":
221
+ return editDecision({
222
+ decision_id: String(a.decision_id ?? ""),
223
+ title: a.title,
224
+ description: a.description,
225
+ options: a.options,
226
+ }, store);
162
227
  default:
163
228
  return text(unknownToolText(name), true);
164
229
  }
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "verdo-mcp",
3
- "version": "1.2.0",
3
+ "version": "2.0.0",
4
4
  "description": "Claude MCP server for Verdo team decisions",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
7
8
  "bin": {
8
9
  "verdo-mcp": "dist/index.js"
9
10
  },
@@ -15,6 +16,7 @@
15
16
  },
16
17
  "scripts": {
17
18
  "build": "tsc",
19
+ "prepack": "npm run build",
18
20
  "start": "node dist/index.js",
19
21
  "test": "vitest run"
20
22
  },