converse-mcp-server 2.29.2 → 3.0.1
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/.env.example +6 -3
- package/README.md +96 -94
- package/docs/API.md +703 -1562
- package/docs/ARCHITECTURE.md +13 -11
- package/docs/EXAMPLES.md +241 -667
- package/docs/PROVIDERS.md +104 -79
- package/package.json +1 -1
- package/src/async/asyncJobStore.js +2 -2
- package/src/async/jobRunner.js +6 -1
- package/src/async/providerStreamNormalizer.js +59 -1
- package/src/config.js +4 -3
- package/src/prompts/helpPrompt.js +43 -61
- package/src/providers/anthropic.js +0 -31
- package/src/providers/claude.js +0 -14
- package/src/providers/codex.js +15 -21
- package/src/providers/copilot.js +36 -202
- package/src/providers/deepseek.js +73 -53
- package/src/providers/gemini-cli.js +0 -3
- package/src/providers/google.js +10 -27
- package/src/providers/interface.js +0 -3
- package/src/providers/mistral.js +169 -63
- package/src/providers/openai-compatible.js +113 -28
- package/src/providers/openai.js +14 -66
- package/src/providers/openrouter-discovery.js +308 -0
- package/src/providers/openrouter.js +452 -282
- package/src/providers/xai.js +298 -280
- package/src/services/summarizationService.js +4 -14
- package/src/systemPrompts.js +19 -2
- package/src/tools/cancelJob.js +7 -1
- package/src/tools/chat.js +957 -995
- package/src/tools/checkStatus.js +1 -0
- package/src/tools/index.js +2 -6
- package/src/tools/modes/parallel.js +488 -0
- package/src/tools/modes/roundtable.js +495 -0
- package/src/tools/modes/streamShared.js +31 -0
- package/src/utils/contextProcessor.js +1 -38
- package/src/utils/conversationExporter.js +6 -26
- package/src/utils/formatStatus.js +46 -19
- package/src/utils/modelRouting.js +207 -4
- package/src/providers/openrouter-endpoints-client.js +0 -220
- package/src/tools/consensus.js +0 -1813
- package/src/tools/conversation.js +0 -1233
package/docs/API.md
CHANGED
|
@@ -1,1562 +1,703 @@
|
|
|
1
|
-
# Converse MCP Server - API Reference
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
The Converse MCP Server
|
|
6
|
-
|
|
7
|
-
1. **Chat Tool**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- **
|
|
22
|
-
- **
|
|
23
|
-
- **
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
- **
|
|
28
|
-
- **
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
"type": "string",
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"
|
|
73
|
-
"description": "
|
|
74
|
-
},
|
|
75
|
-
"
|
|
76
|
-
"type": "
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"description": "
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
{
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
"
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
"
|
|
277
|
-
"
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
"
|
|
350
|
-
"
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
**
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
```
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
- `
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
```bash
|
|
696
|
-
#
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
- Final summaries (1-2 sentences) for completed responses
|
|
705
|
-
- Enhanced check_status display with titles and summaries
|
|
706
|
-
- Persistent storage of summaries with async jobs
|
|
707
|
-
|
|
708
|
-
**Implementation Details:**
|
|
709
|
-
- Uses fast models (gpt-5-nano, gemini-2.5-flash) for minimal latency
|
|
710
|
-
- Temperature set to 0.3 for consistent, focused summaries
|
|
711
|
-
- Graceful fallback to text snippets when disabled or on errors
|
|
712
|
-
- Non-blocking - summarization failures don't affect main flow
|
|
713
|
-
|
|
714
|
-
### Codex Configuration
|
|
715
|
-
|
|
716
|
-
Control Codex behavior through environment variables:
|
|
717
|
-
|
|
718
|
-
**CODEX_SANDBOX_MODE** - Filesystem access control:
|
|
719
|
-
- `read-only` (default): Can read files but not modify
|
|
720
|
-
- `workspace-write`: Can modify files in workspace only
|
|
721
|
-
- `danger-full-access`: Full filesystem access (use in containers only)
|
|
722
|
-
|
|
723
|
-
**CODEX_SKIP_GIT_CHECK** - Git repository requirement:
|
|
724
|
-
- `true` (default): Works in any directory
|
|
725
|
-
- `false`: Requires working directory to be a Git repository
|
|
726
|
-
|
|
727
|
-
**CODEX_APPROVAL_POLICY** - Command approval behavior:
|
|
728
|
-
- `never` (default): Never prompt for approval (recommended for servers)
|
|
729
|
-
- `untrusted`: Prompt for untrusted commands
|
|
730
|
-
- `on-failure`: Prompt when commands fail
|
|
731
|
-
- `on-request`: Let model decide (may hang in headless mode)
|
|
732
|
-
|
|
733
|
-
**Authentication:**
|
|
734
|
-
- Requires ChatGPT login (system-wide, persists across restarts)
|
|
735
|
-
- Alternative: Set `CODEX_API_KEY` environment variable for headless deployments
|
|
736
|
-
|
|
737
|
-
**Example Configuration (.env file):**
|
|
738
|
-
```bash
|
|
739
|
-
# Codex authentication (optional if ChatGPT login available)
|
|
740
|
-
CODEX_API_KEY=your_codex_api_key_here
|
|
741
|
-
|
|
742
|
-
# Codex behavior
|
|
743
|
-
CODEX_SANDBOX_MODE=read-only # Default: read-only
|
|
744
|
-
CODEX_SKIP_GIT_CHECK=true # Default: true
|
|
745
|
-
CODEX_APPROVAL_POLICY=never # Default: never
|
|
746
|
-
```
|
|
747
|
-
|
|
748
|
-
## Context Processing
|
|
749
|
-
|
|
750
|
-
### File Support
|
|
751
|
-
|
|
752
|
-
**Supported Text Formats:**
|
|
753
|
-
- `.txt`, `.md`, `.js`, `.ts`, `.json`, `.yaml`, `.yml`
|
|
754
|
-
- `.py`, `.java`, `.c`, `.cpp`, `.h`, `.css`, `.html`
|
|
755
|
-
- `.xml`, `.csv`, `.sql`, `.sh`, `.bat`, `.log`
|
|
756
|
-
|
|
757
|
-
**Supported Image Formats:**
|
|
758
|
-
- `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.bmp`
|
|
759
|
-
|
|
760
|
-
**Size Limits:**
|
|
761
|
-
- Text files: 1MB default
|
|
762
|
-
- Image files: 10MB default
|
|
763
|
-
|
|
764
|
-
### File Processing
|
|
765
|
-
|
|
766
|
-
```json
|
|
767
|
-
{
|
|
768
|
-
"files": [
|
|
769
|
-
"/absolute/path/to/file.js",
|
|
770
|
-
"./relative/path/to/file.md"
|
|
771
|
-
]
|
|
772
|
-
}
|
|
773
|
-
```
|
|
774
|
-
|
|
775
|
-
**Response includes:**
|
|
776
|
-
- File content with line numbers
|
|
777
|
-
- Metadata (size, last modified)
|
|
778
|
-
- Error handling for inaccessible files
|
|
779
|
-
|
|
780
|
-
### Image Processing
|
|
781
|
-
|
|
782
|
-
```json
|
|
783
|
-
{
|
|
784
|
-
"images": [
|
|
785
|
-
"/path/to/diagram.png",
|
|
786
|
-
"data:image/jpeg;base64,/9j/4AAQ..."
|
|
787
|
-
]
|
|
788
|
-
}
|
|
789
|
-
```
|
|
790
|
-
|
|
791
|
-
**Features:**
|
|
792
|
-
- Base64 encoding for AI processing
|
|
793
|
-
- MIME type detection
|
|
794
|
-
- Size validation
|
|
795
|
-
- Security path checking
|
|
796
|
-
|
|
797
|
-
## Continuation System
|
|
798
|
-
|
|
799
|
-
### Creating Conversations
|
|
800
|
-
|
|
801
|
-
First request creates a continuation automatically:
|
|
802
|
-
|
|
803
|
-
```json
|
|
804
|
-
{
|
|
805
|
-
"prompt": "Start a conversation about architecture",
|
|
806
|
-
"model": "auto"
|
|
807
|
-
}
|
|
808
|
-
```
|
|
809
|
-
|
|
810
|
-
Response includes continuation ID:
|
|
811
|
-
|
|
812
|
-
```json
|
|
813
|
-
{
|
|
814
|
-
"content": "Let's discuss architecture...",
|
|
815
|
-
"continuation": {
|
|
816
|
-
"id": "conv_abc123",
|
|
817
|
-
"provider": "openai",
|
|
818
|
-
"model": "gpt-5-mini",
|
|
819
|
-
"messageCount": 2
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
```
|
|
823
|
-
|
|
824
|
-
### Continuing Conversations
|
|
825
|
-
|
|
826
|
-
Use the continuation ID in subsequent requests:
|
|
827
|
-
|
|
828
|
-
```json
|
|
829
|
-
{
|
|
830
|
-
"prompt": "What about microservices?",
|
|
831
|
-
"continuation_id": "conv_abc123"
|
|
832
|
-
}
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
**Features:**
|
|
836
|
-
- Persistent conversation history
|
|
837
|
-
- Provider and model consistency
|
|
838
|
-
- Message count tracking
|
|
839
|
-
- Automatic expiration
|
|
840
|
-
|
|
841
|
-
### ⚠️ Known Issues
|
|
842
|
-
|
|
843
|
-
**Continuation ID Missing (Critical):**
|
|
844
|
-
```json
|
|
845
|
-
// Some responses may not include continuation metadata
|
|
846
|
-
{
|
|
847
|
-
"content": "Response without continuation...",
|
|
848
|
-
// Missing: continuation field
|
|
849
|
-
}
|
|
850
|
-
```
|
|
851
|
-
|
|
852
|
-
**Workaround:** Use single-turn interactions until fixed. Track conversation manually if needed.
|
|
853
|
-
|
|
854
|
-
**Status:** Implementation gap identified in integration testing. High priority fix planned.
|
|
855
|
-
|
|
856
|
-
## Error Handling
|
|
857
|
-
|
|
858
|
-
### Common Error Responses
|
|
859
|
-
|
|
860
|
-
**Missing API Key:**
|
|
861
|
-
```json
|
|
862
|
-
{
|
|
863
|
-
"error": "Provider not available. Check API key configuration.",
|
|
864
|
-
"code": "PROVIDER_UNAVAILABLE",
|
|
865
|
-
"provider": "openai"
|
|
866
|
-
}
|
|
867
|
-
```
|
|
868
|
-
|
|
869
|
-
**Invalid Model:**
|
|
870
|
-
```json
|
|
871
|
-
{
|
|
872
|
-
"error": "Model not found: invalid-model",
|
|
873
|
-
"code": "MODEL_NOT_FOUND",
|
|
874
|
-
"provider": "openai"
|
|
875
|
-
}
|
|
876
|
-
```
|
|
877
|
-
|
|
878
|
-
**Rate Limiting:**
|
|
879
|
-
```json
|
|
880
|
-
{
|
|
881
|
-
"error": "OpenAI rate limit exceeded",
|
|
882
|
-
"code": "RATE_LIMIT_EXCEEDED",
|
|
883
|
-
"provider": "openai",
|
|
884
|
-
"retry_after": 60
|
|
885
|
-
}
|
|
886
|
-
```
|
|
887
|
-
|
|
888
|
-
**Context Too Large:**
|
|
889
|
-
```json
|
|
890
|
-
{
|
|
891
|
-
"error": "Context length exceeded for model",
|
|
892
|
-
"code": "CONTEXT_LENGTH_EXCEEDED",
|
|
893
|
-
"max_tokens": 128000,
|
|
894
|
-
"provided_tokens": 150000
|
|
895
|
-
}
|
|
896
|
-
```
|
|
897
|
-
|
|
898
|
-
## Rate Limits & Quotas
|
|
899
|
-
|
|
900
|
-
### Provider Limits
|
|
901
|
-
|
|
902
|
-
**OpenAI:**
|
|
903
|
-
- Rate limits vary by model and tier
|
|
904
|
-
- Automatic retry with exponential backoff
|
|
905
|
-
- Error codes: `rate_limit_error`, `insufficient_quota`
|
|
906
|
-
|
|
907
|
-
**Google:**
|
|
908
|
-
- Free tier: 50 requests/day
|
|
909
|
-
- Paid: Based on quota settings
|
|
910
|
-
- Automatic retry for temporary failures
|
|
911
|
-
|
|
912
|
-
**X.AI:**
|
|
913
|
-
- Based on account tier
|
|
914
|
-
- Higher limits for paid accounts
|
|
915
|
-
- Standard HTTP 429 handling
|
|
916
|
-
|
|
917
|
-
### Server Limits
|
|
918
|
-
|
|
919
|
-
**Default Limits:**
|
|
920
|
-
- Max output tokens: 25,000 (configurable to 200,000)
|
|
921
|
-
- Request timeout: 5 minutes
|
|
922
|
-
- Concurrent requests: Unlimited
|
|
923
|
-
|
|
924
|
-
**Configuration:**
|
|
925
|
-
```bash
|
|
926
|
-
MAX_MCP_OUTPUT_TOKENS=200000
|
|
927
|
-
REQUEST_TIMEOUT_MS=300000
|
|
928
|
-
```
|
|
929
|
-
|
|
930
|
-
## Authentication
|
|
931
|
-
|
|
932
|
-
### API Key Management
|
|
933
|
-
|
|
934
|
-
**Environment Variables:**
|
|
935
|
-
```bash
|
|
936
|
-
OPENAI_API_KEY=sk-proj-...
|
|
937
|
-
GOOGLE_API_KEY=AIzaSy...
|
|
938
|
-
XAI_API_KEY=xai-...
|
|
939
|
-
```
|
|
940
|
-
|
|
941
|
-
**MCP Client Configuration:**
|
|
942
|
-
```json
|
|
943
|
-
{
|
|
944
|
-
"env": {
|
|
945
|
-
"OPENAI_API_KEY": "sk-proj-...",
|
|
946
|
-
"GOOGLE_API_KEY": "AIzaSy...",
|
|
947
|
-
"XAI_API_KEY": "xai-..."
|
|
948
|
-
}
|
|
949
|
-
}
|
|
950
|
-
```
|
|
951
|
-
|
|
952
|
-
### Security
|
|
953
|
-
|
|
954
|
-
**Features:**
|
|
955
|
-
- API keys never logged or exposed
|
|
956
|
-
- Path traversal protection for files
|
|
957
|
-
- File access limited to allowed directories
|
|
958
|
-
- Input validation on all parameters
|
|
959
|
-
|
|
960
|
-
## Performance
|
|
961
|
-
|
|
962
|
-
### Response Times
|
|
963
|
-
|
|
964
|
-
**Typical Performance:**
|
|
965
|
-
- Simple chat: 500-2000ms
|
|
966
|
-
- Complex reasoning: 2-10 seconds
|
|
967
|
-
- Consensus (3 models): 3-15 seconds
|
|
968
|
-
- File processing: <100ms per file
|
|
969
|
-
|
|
970
|
-
**Optimization:**
|
|
971
|
-
- Parallel consensus execution
|
|
972
|
-
- Efficient context processing
|
|
973
|
-
- Connection pooling
|
|
974
|
-
- Response caching for repeated requests
|
|
975
|
-
|
|
976
|
-
### Monitoring
|
|
977
|
-
|
|
978
|
-
**Metrics Available:**
|
|
979
|
-
- Response times per provider
|
|
980
|
-
- Token usage statistics
|
|
981
|
-
- Error rates and types
|
|
982
|
-
- Request concurrency
|
|
983
|
-
|
|
984
|
-
**Logging:**
|
|
985
|
-
```bash
|
|
986
|
-
LOG_LEVEL=debug # Detailed operation logs
|
|
987
|
-
LOG_LEVEL=info # Standard operation logs
|
|
988
|
-
LOG_LEVEL=error # Errors only
|
|
989
|
-
```
|
|
990
|
-
|
|
991
|
-
## Examples
|
|
992
|
-
|
|
993
|
-
### Basic Chat
|
|
994
|
-
|
|
995
|
-
```json
|
|
996
|
-
{
|
|
997
|
-
"tool": "chat",
|
|
998
|
-
"arguments": {
|
|
999
|
-
"prompt": "Explain the benefits of TypeScript over JavaScript",
|
|
1000
|
-
"model": "gemini-2.5-flash",
|
|
1001
|
-
"temperature": 0.3
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
```
|
|
1005
|
-
|
|
1006
|
-
### Chat with Context
|
|
1007
|
-
|
|
1008
|
-
```json
|
|
1009
|
-
{
|
|
1010
|
-
"tool": "chat",
|
|
1011
|
-
"arguments": {
|
|
1012
|
-
"prompt": "Review this code for potential security vulnerabilities",
|
|
1013
|
-
"model": "o3",
|
|
1014
|
-
"files": ["/project/src/auth.js", "/project/src/middleware.js"],
|
|
1015
|
-
"reasoning_effort": "high",
|
|
1016
|
-
"temperature": 0.1
|
|
1017
|
-
}
|
|
1018
|
-
}
|
|
1019
|
-
```
|
|
1020
|
-
|
|
1021
|
-
### Simple Consensus
|
|
1022
|
-
|
|
1023
|
-
```json
|
|
1024
|
-
{
|
|
1025
|
-
"tool": "consensus",
|
|
1026
|
-
"arguments": {
|
|
1027
|
-
"prompt": "What's the best approach for implementing real-time notifications?",
|
|
1028
|
-
"models": [
|
|
1029
|
-
{"model": "o3"},
|
|
1030
|
-
{"model": "flash"},
|
|
1031
|
-
{"model": "grok"}
|
|
1032
|
-
],
|
|
1033
|
-
"enable_cross_feedback": false,
|
|
1034
|
-
"temperature": 0.2
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
```
|
|
1038
|
-
|
|
1039
|
-
### Advanced Consensus
|
|
1040
|
-
|
|
1041
|
-
```json
|
|
1042
|
-
{
|
|
1043
|
-
"tool": "consensus",
|
|
1044
|
-
"arguments": {
|
|
1045
|
-
"prompt": "Design a scalable architecture for a video streaming platform",
|
|
1046
|
-
"models": [
|
|
1047
|
-
{"model": "o3"},
|
|
1048
|
-
{"model": "gemini-2.5-pro"},
|
|
1049
|
-
{"model": "grok-4"}
|
|
1050
|
-
],
|
|
1051
|
-
"files": [
|
|
1052
|
-
"/docs/requirements.md",
|
|
1053
|
-
"/docs/current_architecture.md",
|
|
1054
|
-
"/docs/performance_goals.md"
|
|
1055
|
-
],
|
|
1056
|
-
"images": ["/diagrams/current_system.png"],
|
|
1057
|
-
"enable_cross_feedback": true,
|
|
1058
|
-
"cross_feedback_prompt": "Focus on scalability and cost optimization in your refinement",
|
|
1059
|
-
"temperature": 0.15,
|
|
1060
|
-
"reasoning_effort": "max"
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
```
|
|
1064
|
-
|
|
1065
|
-
## Troubleshooting
|
|
1066
|
-
|
|
1067
|
-
### Debug Mode
|
|
1068
|
-
|
|
1069
|
-
Enable detailed logging:
|
|
1070
|
-
|
|
1071
|
-
```bash
|
|
1072
|
-
LOG_LEVEL=debug npx converse-mcp-server
|
|
1073
|
-
```
|
|
1074
|
-
|
|
1075
|
-
### Test API Keys
|
|
1076
|
-
|
|
1077
|
-
```bash
|
|
1078
|
-
# Test OpenAI
|
|
1079
|
-
curl -H "Authorization: Bearer $OPENAI_API_KEY" https://api.openai.com/v1/models
|
|
1080
|
-
|
|
1081
|
-
# Test Google (replace YOUR_KEY)
|
|
1082
|
-
curl "https://generativelanguage.googleapis.com/v1beta/models?key=YOUR_KEY"
|
|
1083
|
-
|
|
1084
|
-
# Test X.AI
|
|
1085
|
-
curl -H "Authorization: Bearer $XAI_API_KEY" https://api.x.ai/v1/models
|
|
1086
|
-
```
|
|
1087
|
-
|
|
1088
|
-
### Common Issues
|
|
1089
|
-
|
|
1090
|
-
**"No providers available":**
|
|
1091
|
-
- Check API key environment variables
|
|
1092
|
-
- Verify API key format and validity
|
|
1093
|
-
- Ensure at least one provider is configured
|
|
1094
|
-
|
|
1095
|
-
**"Context length exceeded":**
|
|
1096
|
-
- Reduce file content or prompt length
|
|
1097
|
-
- Use shorter conversation history
|
|
1098
|
-
- Switch to model with larger context window
|
|
1099
|
-
|
|
1100
|
-
**Slow responses:**
|
|
1101
|
-
- Check network connectivity
|
|
1102
|
-
- Verify API service status
|
|
1103
|
-
- Consider using faster models (flash, mini variants)
|
|
1104
|
-
|
|
1105
|
-
### 🔍 Integration Test Results & Known Issues
|
|
1106
|
-
|
|
1107
|
-
**Provider-Specific Issues:**
|
|
1108
|
-
|
|
1109
|
-
**Google Provider:**
|
|
1110
|
-
```json
|
|
1111
|
-
{
|
|
1112
|
-
"error": "genAI.getGenerativeModel is not a function",
|
|
1113
|
-
"status": "connected_with_issues",
|
|
1114
|
-
"workaround": "Provider handles gracefully, requests still processed"
|
|
1115
|
-
}
|
|
1116
|
-
```
|
|
1117
|
-
|
|
1118
|
-
**XAI Provider:**
|
|
1119
|
-
```json
|
|
1120
|
-
{
|
|
1121
|
-
"error": "grok-beta does not exist or your team does not have access",
|
|
1122
|
-
"status": "api_key_limitations",
|
|
1123
|
-
"workaround": "Try different model names or contact XAI support"
|
|
1124
|
-
}
|
|
1125
|
-
```
|
|
1126
|
-
|
|
1127
|
-
**Input Validation:**
|
|
1128
|
-
```json
|
|
1129
|
-
{
|
|
1130
|
-
"issue": "Missing required parameters may not be rejected",
|
|
1131
|
-
"impact": "Some invalid requests may be processed",
|
|
1132
|
-
"workaround": "Always provide required parameters like 'prompt'"
|
|
1133
|
-
}
|
|
1134
|
-
```
|
|
1135
|
-
|
|
1136
|
-
**Performance Benchmarks (From Integration Testing):**
|
|
1137
|
-
- **Chat Tool**: 581ms average (OpenAI), excellent performance
|
|
1138
|
-
- **Consensus Tool**: 496ms parallel execution (3 providers), excellent
|
|
1139
|
-
- **File Processing**: 1779ms for analysis, good performance
|
|
1140
|
-
- **Auto Selection**: 1900ms, acceptable for complex selection
|
|
1141
|
-
- **Success Rate**: 75% (6/8 tests passing), core functionality working
|
|
1142
|
-
|
|
1143
|
-
**Validated Functionality:**
|
|
1144
|
-
- ✅ Real API connectivity to all three providers
|
|
1145
|
-
- ✅ Chat tool with actual AI responses
|
|
1146
|
-
- ✅ Consensus tool with parallel execution
|
|
1147
|
-
- ✅ File context processing and analysis
|
|
1148
|
-
- ✅ HTTP transport for MCP protocol
|
|
1149
|
-
- ✅ Automatic provider selection
|
|
1150
|
-
- ✅ Graceful error handling for provider issues
|
|
1151
|
-
|
|
1152
|
-
## 🔧 Extension Guide
|
|
1153
|
-
|
|
1154
|
-
### Adding New Providers
|
|
1155
|
-
|
|
1156
|
-
Create a new provider by implementing the standard interface:
|
|
1157
|
-
|
|
1158
|
-
```javascript
|
|
1159
|
-
// src/providers/newprovider.js
|
|
1160
|
-
export async function invoke(messages, options = {}) {
|
|
1161
|
-
// Validate API key availability
|
|
1162
|
-
if (!process.env.NEWPROVIDER_API_KEY) {
|
|
1163
|
-
throw new Error('NEWPROVIDER_API_KEY not configured');
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
try {
|
|
1167
|
-
// Implement API call logic
|
|
1168
|
-
const response = await apiCall(messages, options);
|
|
1169
|
-
|
|
1170
|
-
return {
|
|
1171
|
-
content: response.text,
|
|
1172
|
-
stop_reason: response.stop_reason || 'stop',
|
|
1173
|
-
rawResponse: response
|
|
1174
|
-
};
|
|
1175
|
-
} catch (error) {
|
|
1176
|
-
throw new Error(`New Provider error: ${error.message}`);
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
|
-
export function isAvailable() {
|
|
1181
|
-
return Boolean(process.env.NEWPROVIDER_API_KEY);
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
export const supportedModels = ['model-1', 'model-2'];
|
|
1185
|
-
export const name = 'newprovider';
|
|
1186
|
-
```
|
|
1187
|
-
|
|
1188
|
-
**Registration:**
|
|
1189
|
-
Add to `src/providers/index.js`:
|
|
1190
|
-
```javascript
|
|
1191
|
-
import * as newprovider from './newprovider.js';
|
|
1192
|
-
|
|
1193
|
-
export const providers = {
|
|
1194
|
-
// ... existing providers
|
|
1195
|
-
newprovider: newprovider
|
|
1196
|
-
};
|
|
1197
|
-
```
|
|
1198
|
-
|
|
1199
|
-
### Adding New Tools
|
|
1200
|
-
|
|
1201
|
-
Create a new tool following the MCP tool pattern:
|
|
1202
|
-
|
|
1203
|
-
```javascript
|
|
1204
|
-
// src/tools/newtool.js
|
|
1205
|
-
import { createToolResponse, createToolError } from './index.js';
|
|
1206
|
-
|
|
1207
|
-
export async function newTool(args, dependencies) {
|
|
1208
|
-
const { config, providers, continuationStore } = dependencies;
|
|
1209
|
-
|
|
1210
|
-
try {
|
|
1211
|
-
// Validate required arguments
|
|
1212
|
-
if (!args.requiredParam) {
|
|
1213
|
-
return createToolError('requiredParam is required');
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
|
-
// Implement tool logic
|
|
1217
|
-
const result = await processToolLogic(args, dependencies);
|
|
1218
|
-
|
|
1219
|
-
return createToolResponse(result);
|
|
1220
|
-
} catch (error) {
|
|
1221
|
-
return createToolError(`Tool execution failed: ${error.message}`);
|
|
1222
|
-
}
|
|
1223
|
-
}
|
|
1224
|
-
|
|
1225
|
-
// Tool definition for MCP registration
|
|
1226
|
-
export const newToolDefinition = {
|
|
1227
|
-
name: 'newtool',
|
|
1228
|
-
description: 'Description of what the new tool does',
|
|
1229
|
-
inputSchema: {
|
|
1230
|
-
type: 'object',
|
|
1231
|
-
properties: {
|
|
1232
|
-
requiredParam: {
|
|
1233
|
-
type: 'string',
|
|
1234
|
-
description: 'Description of required parameter'
|
|
1235
|
-
},
|
|
1236
|
-
optionalParam: {
|
|
1237
|
-
type: 'boolean',
|
|
1238
|
-
default: false,
|
|
1239
|
-
description: 'Description of optional parameter'
|
|
1240
|
-
}
|
|
1241
|
-
},
|
|
1242
|
-
required: ['requiredParam']
|
|
1243
|
-
}
|
|
1244
|
-
};
|
|
1245
|
-
```
|
|
1246
|
-
|
|
1247
|
-
**Registration:**
|
|
1248
|
-
Add to `src/tools/index.js`:
|
|
1249
|
-
```javascript
|
|
1250
|
-
import { newTool, newToolDefinition } from './newtool.js';
|
|
1251
|
-
|
|
1252
|
-
export const tools = {
|
|
1253
|
-
// ... existing tools
|
|
1254
|
-
newtool: newTool
|
|
1255
|
-
};
|
|
1256
|
-
|
|
1257
|
-
export const toolDefinitions = {
|
|
1258
|
-
// ... existing definitions
|
|
1259
|
-
newtool: newToolDefinition
|
|
1260
|
-
};
|
|
1261
|
-
```
|
|
1262
|
-
|
|
1263
|
-
### Configuration Extensions
|
|
1264
|
-
|
|
1265
|
-
Add new configuration options:
|
|
1266
|
-
|
|
1267
|
-
```javascript
|
|
1268
|
-
// src/config.js
|
|
1269
|
-
export const config = {
|
|
1270
|
-
// ... existing config
|
|
1271
|
-
|
|
1272
|
-
newFeature: {
|
|
1273
|
-
enabled: process.env.NEW_FEATURE_ENABLED === 'true',
|
|
1274
|
-
timeout: parseInt(process.env.NEW_FEATURE_TIMEOUT) || 30000,
|
|
1275
|
-
customOption: process.env.NEW_FEATURE_OPTION || 'default'
|
|
1276
|
-
}
|
|
1277
|
-
};
|
|
1278
|
-
```
|
|
1279
|
-
|
|
1280
|
-
### Testing Extensions
|
|
1281
|
-
|
|
1282
|
-
Create tests for new components:
|
|
1283
|
-
|
|
1284
|
-
```javascript
|
|
1285
|
-
// tests/providers/newprovider.test.js
|
|
1286
|
-
import { describe, it, expect } from 'vitest';
|
|
1287
|
-
import * as newProvider from '../../src/providers/newprovider.js';
|
|
1288
|
-
|
|
1289
|
-
describe('New Provider', () => {
|
|
1290
|
-
it('should implement required interface', () => {
|
|
1291
|
-
expect(newProvider.invoke).toBeDefined();
|
|
1292
|
-
expect(newProvider.isAvailable).toBeDefined();
|
|
1293
|
-
expect(newProvider.name).toBe('newprovider');
|
|
1294
|
-
});
|
|
1295
|
-
|
|
1296
|
-
it('should handle API calls correctly', async () => {
|
|
1297
|
-
// Test implementation
|
|
1298
|
-
});
|
|
1299
|
-
});
|
|
1300
|
-
```
|
|
1301
|
-
|
|
1302
|
-
### Check Status Tool
|
|
1303
|
-
|
|
1304
|
-
**Description**: Monitor progress and retrieve results from asynchronous operations.
|
|
1305
|
-
|
|
1306
|
-
#### Request Schema
|
|
1307
|
-
|
|
1308
|
-
```json
|
|
1309
|
-
{
|
|
1310
|
-
"type": "object",
|
|
1311
|
-
"properties": {
|
|
1312
|
-
"continuation_id": {
|
|
1313
|
-
"type": "string",
|
|
1314
|
-
"description": "Optional job continuation ID to query. If not provided, returns the 10 most recent jobs."
|
|
1315
|
-
},
|
|
1316
|
-
"full_history": {
|
|
1317
|
-
"type": "boolean",
|
|
1318
|
-
"default": false,
|
|
1319
|
-
"description": "When used with continuation_id, returns the full conversation history for that continuation ID."
|
|
1320
|
-
}
|
|
1321
|
-
},
|
|
1322
|
-
"additionalProperties": false
|
|
1323
|
-
}
|
|
1324
|
-
```
|
|
1325
|
-
|
|
1326
|
-
#### Response Format
|
|
1327
|
-
|
|
1328
|
-
**Status Check Response:**
|
|
1329
|
-
```json
|
|
1330
|
-
{
|
|
1331
|
-
"content": {
|
|
1332
|
-
"id": "conv_abc123def",
|
|
1333
|
-
"status": "completed",
|
|
1334
|
-
"tool": "chat",
|
|
1335
|
-
"progress": {
|
|
1336
|
-
"completed": 1,
|
|
1337
|
-
"total": 1,
|
|
1338
|
-
"percentage": 100
|
|
1339
|
-
},
|
|
1340
|
-
"result": {
|
|
1341
|
-
"content": "Final AI response...",
|
|
1342
|
-
"metadata": {
|
|
1343
|
-
"provider": "openai",
|
|
1344
|
-
"model": "gpt-5",
|
|
1345
|
-
"usage": {
|
|
1346
|
-
"input_tokens": 150,
|
|
1347
|
-
"output_tokens": 85
|
|
1348
|
-
}
|
|
1349
|
-
}
|
|
1350
|
-
},
|
|
1351
|
-
"elapsed_seconds": 4.2,
|
|
1352
|
-
"completed_at": "2023-12-01T10:30:04.200Z"
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
```
|
|
1356
|
-
|
|
1357
|
-
**Recent Jobs List Response:**
|
|
1358
|
-
```json
|
|
1359
|
-
{
|
|
1360
|
-
"content": {
|
|
1361
|
-
"jobs": [
|
|
1362
|
-
{
|
|
1363
|
-
"id": "conv_abc123def",
|
|
1364
|
-
"status": "completed",
|
|
1365
|
-
"tool": "chat",
|
|
1366
|
-
"elapsed_seconds": 4.2,
|
|
1367
|
-
"completed_at": "2023-12-01T10:30:04.200Z"
|
|
1368
|
-
},
|
|
1369
|
-
{
|
|
1370
|
-
"id": "consensus_xyz789",
|
|
1371
|
-
"status": "processing",
|
|
1372
|
-
"tool": "consensus",
|
|
1373
|
-
"progress": {
|
|
1374
|
-
"completed": 2,
|
|
1375
|
-
"total": 3,
|
|
1376
|
-
"percentage": 67
|
|
1377
|
-
},
|
|
1378
|
-
"elapsed_seconds": 8.5
|
|
1379
|
-
}
|
|
1380
|
-
]
|
|
1381
|
-
}
|
|
1382
|
-
}
|
|
1383
|
-
```
|
|
1384
|
-
|
|
1385
|
-
#### Example Usage
|
|
1386
|
-
|
|
1387
|
-
```json
|
|
1388
|
-
// Check specific job
|
|
1389
|
-
{
|
|
1390
|
-
"continuation_id": "conv_abc123def"
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
// List recent jobs
|
|
1394
|
-
{}
|
|
1395
|
-
|
|
1396
|
-
// Get full history for completed job
|
|
1397
|
-
{
|
|
1398
|
-
"continuation_id": "conv_abc123def",
|
|
1399
|
-
"full_history": true
|
|
1400
|
-
}
|
|
1401
|
-
```
|
|
1402
|
-
|
|
1403
|
-
### Cancel Job Tool
|
|
1404
|
-
|
|
1405
|
-
**Description**: Cancel running asynchronous operations when needed.
|
|
1406
|
-
|
|
1407
|
-
#### Request Schema
|
|
1408
|
-
|
|
1409
|
-
```json
|
|
1410
|
-
{
|
|
1411
|
-
"type": "object",
|
|
1412
|
-
"properties": {
|
|
1413
|
-
"continuation_id": {
|
|
1414
|
-
"type": "string",
|
|
1415
|
-
"description": "The continuation_id of the job to cancel"
|
|
1416
|
-
}
|
|
1417
|
-
},
|
|
1418
|
-
"required": ["continuation_id"],
|
|
1419
|
-
"additionalProperties": false
|
|
1420
|
-
}
|
|
1421
|
-
```
|
|
1422
|
-
|
|
1423
|
-
#### Response Format
|
|
1424
|
-
|
|
1425
|
-
**Successful Cancellation:**
|
|
1426
|
-
```json
|
|
1427
|
-
{
|
|
1428
|
-
"content": {
|
|
1429
|
-
"status": "cancelled",
|
|
1430
|
-
"message": "Job conv_abc123def cancelled successfully",
|
|
1431
|
-
"job_id": "conv_abc123def",
|
|
1432
|
-
"elapsed_seconds": 2.1,
|
|
1433
|
-
"cancelled_at": "2023-12-01T10:30:02.100Z"
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
|
-
```
|
|
1437
|
-
|
|
1438
|
-
**Already Completed:**
|
|
1439
|
-
```json
|
|
1440
|
-
{
|
|
1441
|
-
"content": {
|
|
1442
|
-
"status": "completed",
|
|
1443
|
-
"message": "Job conv_abc123def has already completed and cannot be cancelled",
|
|
1444
|
-
"job_id": "conv_abc123def"
|
|
1445
|
-
}
|
|
1446
|
-
}
|
|
1447
|
-
```
|
|
1448
|
-
|
|
1449
|
-
#### Example Usage
|
|
1450
|
-
|
|
1451
|
-
```json
|
|
1452
|
-
{
|
|
1453
|
-
"continuation_id": "conv_abc123def"
|
|
1454
|
-
}
|
|
1455
|
-
```
|
|
1456
|
-
|
|
1457
|
-
## Asynchronous Execution
|
|
1458
|
-
|
|
1459
|
-
### Overview
|
|
1460
|
-
|
|
1461
|
-
The Chat, Consensus, and Conversation tools support asynchronous execution mode for long-running operations. When `async: true` is specified:
|
|
1462
|
-
|
|
1463
|
-
1. **Immediate Response**: Returns a `continuation_id` instantly
|
|
1464
|
-
2. **Background Processing**: Job runs in the background with streaming support
|
|
1465
|
-
3. **Status Monitoring**: Use `check_status` tool to monitor progress
|
|
1466
|
-
4. **Result Retrieval**: Full results available when job completes
|
|
1467
|
-
5. **Cancellation**: Use `cancel_job` tool to stop running operations
|
|
1468
|
-
|
|
1469
|
-
### Async Workflow
|
|
1470
|
-
|
|
1471
|
-
```mermaid
|
|
1472
|
-
sequenceDiagram
|
|
1473
|
-
participant Client
|
|
1474
|
-
participant Server
|
|
1475
|
-
participant Provider
|
|
1476
|
-
|
|
1477
|
-
Client->>Server: chat(prompt, async=true)
|
|
1478
|
-
Server-->>Client: continuation_id (immediate)
|
|
1479
|
-
|
|
1480
|
-
Server->>Provider: Background execution
|
|
1481
|
-
Provider-->>Server: Streaming response
|
|
1482
|
-
|
|
1483
|
-
loop Status Checking
|
|
1484
|
-
Client->>Server: check_status(continuation_id)
|
|
1485
|
-
Server-->>Client: Progress update
|
|
1486
|
-
end
|
|
1487
|
-
|
|
1488
|
-
Provider->>Server: Final response
|
|
1489
|
-
Server->>Server: Cache result
|
|
1490
|
-
|
|
1491
|
-
Client->>Server: check_status(continuation_id)
|
|
1492
|
-
Server-->>Client: Complete result
|
|
1493
|
-
```
|
|
1494
|
-
|
|
1495
|
-
### Status Types
|
|
1496
|
-
|
|
1497
|
-
| Status | Description | Actions Available |
|
|
1498
|
-
|--------|-------------|------------------|
|
|
1499
|
-
| `processing` | Job is running | Cancel, Check Status |
|
|
1500
|
-
| `completed` | Job finished successfully | Get Results |
|
|
1501
|
-
| `failed` | Job encountered an error | Check Error Details |
|
|
1502
|
-
| `cancelled` | Job was cancelled by user | None |
|
|
1503
|
-
| `completed_with_errors` | Partial success (consensus only) | Get Partial Results |
|
|
1504
|
-
|
|
1505
|
-
### Caching System
|
|
1506
|
-
|
|
1507
|
-
**Memory Cache (24 hours):**
|
|
1508
|
-
- Active jobs and recent completions
|
|
1509
|
-
- Fast lookup for status checks
|
|
1510
|
-
- Automatic cleanup
|
|
1511
|
-
|
|
1512
|
-
**Disk Cache (3 days):**
|
|
1513
|
-
- Long-term result storage
|
|
1514
|
-
- Survives server restarts
|
|
1515
|
-
- Automatic cleanup of old results
|
|
1516
|
-
|
|
1517
|
-
### Performance Considerations
|
|
1518
|
-
|
|
1519
|
-
**Async Benefits:**
|
|
1520
|
-
- Non-blocking client operations
|
|
1521
|
-
- Better resource utilization
|
|
1522
|
-
- Parallel processing for consensus
|
|
1523
|
-
- Graceful handling of long operations
|
|
1524
|
-
|
|
1525
|
-
**When to Use Async:**
|
|
1526
|
-
- Long analysis tasks (>30 seconds)
|
|
1527
|
-
- Large file processing
|
|
1528
|
-
- Multi-model consensus
|
|
1529
|
-
- Complex reasoning operations
|
|
1530
|
-
- Batch operations
|
|
1531
|
-
|
|
1532
|
-
### Best Practices
|
|
1533
|
-
|
|
1534
|
-
**Provider Development:**
|
|
1535
|
-
- Always check API key availability in `isAvailable()`
|
|
1536
|
-
- Implement consistent error handling
|
|
1537
|
-
- Follow the standard response format
|
|
1538
|
-
- Add comprehensive logging
|
|
1539
|
-
- Handle rate limiting gracefully
|
|
1540
|
-
|
|
1541
|
-
**Tool Development:**
|
|
1542
|
-
- Validate all input parameters
|
|
1543
|
-
- Use dependency injection pattern
|
|
1544
|
-
- Return standardized responses
|
|
1545
|
-
- Implement proper error handling
|
|
1546
|
-
- Add detailed input schema
|
|
1547
|
-
|
|
1548
|
-
**Testing:**
|
|
1549
|
-
- Write unit tests for core logic
|
|
1550
|
-
- Add integration tests with mocked APIs
|
|
1551
|
-
- Test error conditions thoroughly
|
|
1552
|
-
- Validate input/output formats
|
|
1553
|
-
|
|
1554
|
-
**Documentation:**
|
|
1555
|
-
- Update API documentation with new tools/providers
|
|
1556
|
-
- Add usage examples
|
|
1557
|
-
- Document configuration options
|
|
1558
|
-
- Include troubleshooting guides
|
|
1559
|
-
|
|
1560
|
-
---
|
|
1561
|
-
|
|
1562
|
-
For more examples and integration patterns, see [EXAMPLES.md](EXAMPLES.md).
|
|
1
|
+
# Converse MCP Server - API Reference
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
The Converse MCP Server exposes three tools through the Model Context Protocol (MCP):
|
|
6
|
+
|
|
7
|
+
1. **Chat Tool** (`chat`) — a single conversational tool with three execution modes:
|
|
8
|
+
- **`chat`** (default): 1..N models answer independently, in parallel.
|
|
9
|
+
- **`consensus`**: ≥2 models answer in parallel, then refine their answers after seeing each other.
|
|
10
|
+
- **`roundtable`**: models answer sequentially, each building on the running transcript.
|
|
11
|
+
2. **Check Status Tool** (`check_status`) — monitor and retrieve results from asynchronous jobs.
|
|
12
|
+
3. **Cancel Job Tool** (`cancel_job`) — cancel a running background job.
|
|
13
|
+
|
|
14
|
+
The chat tool runs **synchronously** (immediate response) or **asynchronously** (`async: true`, background processing polled with `check_status`). When AI summarization is enabled, the server generates titles and summaries for better context tracking.
|
|
15
|
+
|
|
16
|
+
## Transport Protocols
|
|
17
|
+
|
|
18
|
+
The server supports two transport modes:
|
|
19
|
+
|
|
20
|
+
### HTTP Transport (Default)
|
|
21
|
+
- **Endpoint**: `http://localhost:3157/mcp`
|
|
22
|
+
- **Protocol**: HTTP streaming with JSON-RPC 2.0
|
|
23
|
+
- **Usage**: Best for development, debugging, and web integrations
|
|
24
|
+
- **Features**: Health endpoints, CORS support, session management
|
|
25
|
+
|
|
26
|
+
### Stdio Transport (Legacy)
|
|
27
|
+
- **Protocol**: Standard input/output with JSON-RPC 2.0
|
|
28
|
+
- **Usage**: Traditional MCP client integrations
|
|
29
|
+
- **Features**: Process-based communication, lower latency
|
|
30
|
+
|
|
31
|
+
**Transport Selection:**
|
|
32
|
+
```bash
|
|
33
|
+
# Default (HTTP)
|
|
34
|
+
npm start
|
|
35
|
+
|
|
36
|
+
# Explicit HTTP
|
|
37
|
+
npm start -- --transport=http
|
|
38
|
+
|
|
39
|
+
# Stdio transport
|
|
40
|
+
npm start -- --transport=stdio
|
|
41
|
+
|
|
42
|
+
# Environment variable
|
|
43
|
+
MCP_TRANSPORT=stdio npm start
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Chat Tool
|
|
47
|
+
|
|
48
|
+
**Description**: Talk to one or more AI models. The `mode` parameter selects how the models are orchestrated. Supports files, images, reasoning control, background execution, disk export, and multi-turn threads via `continuation_id`.
|
|
49
|
+
|
|
50
|
+
### Request Schema
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"prompt": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Your question, topic, or task with relevant context. Example: 'How should I structure the authentication module for this Express.js API?'"
|
|
59
|
+
},
|
|
60
|
+
"models": {
|
|
61
|
+
"type": "array",
|
|
62
|
+
"items": { "type": "string" },
|
|
63
|
+
"minItems": 1,
|
|
64
|
+
"description": "Models to use, as plain name strings. Examples: ['auto'], ['codex'], ['codex', 'gemini', 'claude']. Default: ['auto']."
|
|
65
|
+
},
|
|
66
|
+
"mode": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"enum": ["chat", "consensus", "roundtable"],
|
|
69
|
+
"description": "Execution mode. 'chat' (default): independent parallel answers. 'consensus': >=2 models answer then refine via cross-feedback. 'roundtable': sequential turn-based dialogue in the given model order. Default: 'chat'."
|
|
70
|
+
},
|
|
71
|
+
"continuation_id": {
|
|
72
|
+
"type": "string",
|
|
73
|
+
"description": "Continuation ID for a persistent multi-turn thread. Auto-generated in the first response; pass it back to continue. You MAY change the mode or models on a resuming turn."
|
|
74
|
+
},
|
|
75
|
+
"files": {
|
|
76
|
+
"type": "array",
|
|
77
|
+
"items": { "type": "string" },
|
|
78
|
+
"description": "File paths to include as context (absolute or relative). Supports line ranges: file.txt{10:50}, file.txt{100:}. Example: ['./src/utils/auth.js{50:100}', './config.json']."
|
|
79
|
+
},
|
|
80
|
+
"images": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"items": { "type": "string" },
|
|
83
|
+
"description": "Image paths for visual context (absolute or relative paths, or base64 data). Example: ['C:\\Users\\username\\diagram.png', './screenshot.jpg', 'data:image/jpeg;base64,/9j/4AAQ...']."
|
|
84
|
+
},
|
|
85
|
+
"reasoning_effort": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"enum": ["none", "minimal", "low", "medium", "high", "max"],
|
|
88
|
+
"description": "Reasoning depth for thinking models. 'none' (fastest, GPT-5.1+ only), 'minimal', 'low', 'medium' (balanced), 'high', 'max'. Default: 'medium'."
|
|
89
|
+
},
|
|
90
|
+
"async": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"description": "Execute in the background. When true, returns a continuation_id immediately and processes the request asynchronously; poll with check_status. Default: false."
|
|
93
|
+
},
|
|
94
|
+
"export": {
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"description": "Export the conversation to disk. Creates a folder named for the continuation_id with numbered request/response files and metadata. Default: false."
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"required": ["prompt"]
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Only `prompt` is required. `models` defaults to `["auto"]`, `mode` to `"chat"`, and `reasoning_effort` to `"medium"`.
|
|
104
|
+
|
|
105
|
+
### Validation Rules
|
|
106
|
+
|
|
107
|
+
- `models` must be a non-empty array of non-empty strings.
|
|
108
|
+
- Duplicate model entries are rejected in `chat` and `consensus` modes; they are allowed only in `roundtable` (a model may talk to itself across turns).
|
|
109
|
+
- `consensus` mode requires at least **2 available** models after resolution. A single explicit model is rejected — use `chat` mode instead. `["auto"]` is valid in consensus when 2+ providers are configured (it expands to the first 3 available providers).
|
|
110
|
+
|
|
111
|
+
### Modes
|
|
112
|
+
|
|
113
|
+
**`chat` (default) — independent parallel answers**
|
|
114
|
+
|
|
115
|
+
Each model is invoked in parallel and answers independently; models never see each other. With a single model (or `["auto"]`), the response is that model's answer, with automatic provider failover for `"auto"` and Codex thread reuse across turns. With multiple models, the response contains one labeled `### <model>:` section per successful model.
|
|
116
|
+
|
|
117
|
+
**`consensus` — parallel answers, then cross-feedback refinement**
|
|
118
|
+
|
|
119
|
+
All models answer the prompt in parallel (phase 1). A cross-feedback refinement phase then always runs when at least 2 phase-1 responses succeed: each model sees the others' answers and refines its own. The result reports both the initial and refined responses. A single `["auto"]` spec expands to the first 3 available providers' default models.
|
|
120
|
+
|
|
121
|
+
**`roundtable` — sequential turn-based dialogue**
|
|
122
|
+
|
|
123
|
+
Models respond one after another in the exact order given, and each model sees the full running transcript of every turn before it. One tool call runs exactly **one lap** (one turn per model). Pass the returned `continuation_id` to run more laps; every lap appends to one shared, accumulating transcript. A turn that fails is recorded with a note and does not abort the lap.
|
|
124
|
+
|
|
125
|
+
### Response Format
|
|
126
|
+
|
|
127
|
+
**Synchronous — `chat` mode:** the content is a status line, a `continuation_id:` line, then the answer (the status line is omitted in the test environment).
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
✅ COMPLETED | CHAT | conv_abc123 | 2.4s elapsed | openai/gpt-5.6-sol
|
|
131
|
+
continuation_id: conv_abc123
|
|
132
|
+
|
|
133
|
+
<model answer text>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
{
|
|
138
|
+
"content": "…status line + continuation_id + answer…",
|
|
139
|
+
"continuation": {
|
|
140
|
+
"id": "conv_abc123",
|
|
141
|
+
"messageCount": 2,
|
|
142
|
+
"provider": "openai",
|
|
143
|
+
"model": "gpt-5.6-sol"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
For a multi-model `chat` request, the status line reports `N/M succeeded` and lists the models, and `continuation.models` replaces `provider`/`model`.
|
|
149
|
+
|
|
150
|
+
**Synchronous — `consensus` mode:** a status line and `continuation_id:` line, followed by a JSON result object.
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
✅ COMPLETED | CONSENSUS | conv_xyz789 | 6.1s elapsed | 3/3 succeeded | gpt-5.6, gemini-2.5-pro, grok-4.5
|
|
154
|
+
continuation_id: conv_xyz789
|
|
155
|
+
|
|
156
|
+
{
|
|
157
|
+
"status": "consensus_complete",
|
|
158
|
+
"models_consulted": 3,
|
|
159
|
+
"successful_initial_responses": 3,
|
|
160
|
+
"failed_responses": 0,
|
|
161
|
+
"refined_responses": 3,
|
|
162
|
+
"phases": {
|
|
163
|
+
"initial": [
|
|
164
|
+
{
|
|
165
|
+
"model": "gpt-5.6",
|
|
166
|
+
"status": "success",
|
|
167
|
+
"response": "Initial analysis…"
|
|
168
|
+
}
|
|
169
|
+
],
|
|
170
|
+
"refined": [
|
|
171
|
+
{
|
|
172
|
+
"model": "gpt-5.6",
|
|
173
|
+
"status": "success",
|
|
174
|
+
"initial_response": "Initial analysis…",
|
|
175
|
+
"refined_response": "After considering the other perspectives…"
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"failed": []
|
|
179
|
+
},
|
|
180
|
+
"continuation": {
|
|
181
|
+
"id": "conv_xyz789",
|
|
182
|
+
"messageCount": 3
|
|
183
|
+
},
|
|
184
|
+
"settings": {
|
|
185
|
+
"models_requested": ["gpt-5.6", "gemini-2.5-pro", "grok-4.5"]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**Synchronous — `roundtable` mode:** a status line, `continuation_id:` line, and a JSON result object whose top-level `content` holds the rendered transcript.
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
✅ COMPLETED | ROUNDTABLE | conv_abc123 | 3.2s elapsed | 2/2 turns | codex, gemini
|
|
194
|
+
continuation_id: conv_abc123
|
|
195
|
+
|
|
196
|
+
{
|
|
197
|
+
"status": "roundtable_complete",
|
|
198
|
+
"content": "…full rendered transcript of the lap…",
|
|
199
|
+
"models_consulted": 2,
|
|
200
|
+
"successful_turns": 2,
|
|
201
|
+
"failed_turns": 0,
|
|
202
|
+
"turns": [
|
|
203
|
+
{ "model": "codex", "provider": "codex", "status": "success", "response": "Opening analysis…" },
|
|
204
|
+
{ "model": "gemini", "provider": "gemini-cli", "status": "success", "response": "Building on codex's point…" }
|
|
205
|
+
],
|
|
206
|
+
"continuation": {
|
|
207
|
+
"id": "conv_abc123",
|
|
208
|
+
"messageCount": 3
|
|
209
|
+
},
|
|
210
|
+
"settings": {
|
|
211
|
+
"models_requested": ["codex", "gemini"]
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
**Asynchronous (any mode, `async: true`):**
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"content": "⏳ SUBMITTED | CONSENSUS | conv_xyz789 | 1/1 | Started: 01/12/2026 10:30:00 | \"Architecture Review\" | gpt-5.6, gemini-2.5-pro, grok-4.5\ncontinuation_id: conv_xyz789",
|
|
220
|
+
"continuation": {
|
|
221
|
+
"id": "conv_xyz789",
|
|
222
|
+
"status": "processing"
|
|
223
|
+
},
|
|
224
|
+
"async_execution": true
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Poll with `check_status` using the returned `continuation_id`. When complete, the async result carries the full content (answer or rendered transcript) plus the AI-generated title and final summary.
|
|
229
|
+
|
|
230
|
+
### Example Usage
|
|
231
|
+
|
|
232
|
+
**Single-model chat:**
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"prompt": "Review this authentication function for security issues",
|
|
236
|
+
"models": ["gpt-5.6"],
|
|
237
|
+
"files": ["/project/src/auth.js{1:120}", "/project/config/security.json"],
|
|
238
|
+
"reasoning_effort": "high"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Multi-model chat (independent answers):**
|
|
243
|
+
```json
|
|
244
|
+
{
|
|
245
|
+
"prompt": "Suggest a caching strategy for this endpoint",
|
|
246
|
+
"models": ["gpt-5.6", "gemini-2.5-flash", "grok-4.5"],
|
|
247
|
+
"files": ["/project/src/api/routes.js"]
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**Consensus:**
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"prompt": "Should we use microservices or a monolith for our e-commerce platform?",
|
|
255
|
+
"models": ["gpt-5.6", "gemini-2.5-pro", "grok-4.5"],
|
|
256
|
+
"mode": "consensus",
|
|
257
|
+
"files": ["/docs/requirements.md", "/docs/current_architecture.md"],
|
|
258
|
+
"reasoning_effort": "high"
|
|
259
|
+
}
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
**Roundtable (one lap):**
|
|
263
|
+
```json
|
|
264
|
+
{
|
|
265
|
+
"prompt": "Should we adopt event sourcing for the order service?",
|
|
266
|
+
"models": ["codex", "gemini", "claude"],
|
|
267
|
+
"mode": "roundtable"
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**Roundtable (another lap on the same thread):**
|
|
272
|
+
```json
|
|
273
|
+
{
|
|
274
|
+
"prompt": "Now focus specifically on the migration path.",
|
|
275
|
+
"models": ["codex", "gemini", "claude"],
|
|
276
|
+
"mode": "roundtable",
|
|
277
|
+
"continuation_id": "conv_abc123"
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Async chat with conversation export:**
|
|
282
|
+
```json
|
|
283
|
+
{
|
|
284
|
+
"prompt": "Design a scalable architecture for our system",
|
|
285
|
+
"models": ["gpt-5.6"],
|
|
286
|
+
"async": true,
|
|
287
|
+
"export": true,
|
|
288
|
+
"continuation_id": "conv_architecture_design"
|
|
289
|
+
}
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
When `export` is enabled, the conversation is saved to disk under a folder named for the `continuation_id`:
|
|
293
|
+
```
|
|
294
|
+
conv_architecture_design/
|
|
295
|
+
├── 1_request.txt # First user prompt
|
|
296
|
+
├── 1_response.txt # First model response
|
|
297
|
+
├── 2_request.txt # Second user prompt (if continuing)
|
|
298
|
+
├── 2_response.txt # Second model response
|
|
299
|
+
└── metadata.json # Conversation metadata and settings
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
## Check Status Tool
|
|
303
|
+
|
|
304
|
+
**Description**: Query the status and progress of async jobs, or list the most recent jobs.
|
|
305
|
+
|
|
306
|
+
### Request Schema
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"type": "object",
|
|
311
|
+
"properties": {
|
|
312
|
+
"continuation_id": {
|
|
313
|
+
"type": "string",
|
|
314
|
+
"description": "Optional job continuation ID to query. If not provided, returns the 10 most recent jobs."
|
|
315
|
+
},
|
|
316
|
+
"full_history": {
|
|
317
|
+
"type": "boolean",
|
|
318
|
+
"default": false,
|
|
319
|
+
"description": "When used with continuation_id, returns the full conversation history for that continuation ID. Only use when there are multiple turns and you need the whole conversation."
|
|
320
|
+
}
|
|
321
|
+
},
|
|
322
|
+
"additionalProperties": false
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
### Example Usage
|
|
327
|
+
|
|
328
|
+
```json
|
|
329
|
+
// Check a specific job
|
|
330
|
+
{ "continuation_id": "conv_abc123" }
|
|
331
|
+
|
|
332
|
+
// List the 10 most recent jobs
|
|
333
|
+
{}
|
|
334
|
+
|
|
335
|
+
// Get the full conversation history for a thread
|
|
336
|
+
{ "continuation_id": "conv_abc123", "full_history": true }
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
The response renders a human-readable status (start time, elapsed time, turn/model progress, and, when summarization is enabled, an AI-generated title and summary) plus the completed result content when available.
|
|
340
|
+
|
|
341
|
+
## Cancel Job Tool
|
|
342
|
+
|
|
343
|
+
**Description**: Cancel a queued or running async job. Preserves partial results when available.
|
|
344
|
+
|
|
345
|
+
### Request Schema
|
|
346
|
+
|
|
347
|
+
```json
|
|
348
|
+
{
|
|
349
|
+
"type": "object",
|
|
350
|
+
"properties": {
|
|
351
|
+
"continuation_id": {
|
|
352
|
+
"type": "string",
|
|
353
|
+
"description": "The continuation_id of the job to cancel"
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"required": ["continuation_id"],
|
|
357
|
+
"additionalProperties": false
|
|
358
|
+
}
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
### Example Usage
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{ "continuation_id": "conv_abc123" }
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Only jobs in a `queued` or `running` state can be cancelled; already-completed, failed, or cancelled jobs return a non-cancellable status.
|
|
368
|
+
|
|
369
|
+
## Supported Models
|
|
370
|
+
|
|
371
|
+
Provide models as plain name strings in the `models` array. Bare names and aliases resolve to a provider automatically; use a namespace prefix (`claude:`, `gemini:`, `copilot:`, `openrouter:`) or a full `provider/model` slug for explicit routing.
|
|
372
|
+
|
|
373
|
+
### OpenAI Models
|
|
374
|
+
|
|
375
|
+
| Model | Aliases | Context | Output | Notes |
|
|
376
|
+
|-------|---------|---------|--------|-------|
|
|
377
|
+
| `gpt-5.6-sol` | `gpt-5.6`, `gpt-5`, `sol` | 1M | 128K | Flagship, default OpenAI model |
|
|
378
|
+
| `gpt-5.6-terra` | `terra` | 400K | 128K | Lower-cost flagship-class tier |
|
|
379
|
+
| `gpt-5.6-luna` | `luna` | 400K | 128K | Fastest, most affordable tier |
|
|
380
|
+
| `gpt-5.4` | — | 1M | 128K | Flagship-class reasoning |
|
|
381
|
+
| `gpt-5.4-pro` | `gpt-5-pro` | 1M | 272K | Maximum performance (expensive) |
|
|
382
|
+
| `gpt-5-mini`, `gpt-5-nano` | — | 400K | 128K | Fast, cost-efficient tiers |
|
|
383
|
+
| `gpt-5.4-mini`, `gpt-5.4-nano` | — | 400K | 128K | Fast GPT-5.4 tiers |
|
|
384
|
+
| `o3`, `o3-pro`, `o4-mini` | — | 200K | 100K | Reasoning models |
|
|
385
|
+
| `gpt-4.1` | `gpt-4.1` | 1M | 32K | Large context |
|
|
386
|
+
| `o3-deep-research`, `o4-mini-deep-research` | — | 200K | 100K | Deep research (long runtime) |
|
|
387
|
+
|
|
388
|
+
### Google / Gemini Models (API-based)
|
|
389
|
+
|
|
390
|
+
| Model | Aliases | Context | Output | Notes |
|
|
391
|
+
|-------|---------|---------|--------|-------|
|
|
392
|
+
| `gemini-3.1-pro-preview` | `pro`, `gemini-pro` | 1M | 64K | Most advanced reasoning, expanded thinking levels |
|
|
393
|
+
| `gemini-3.5-flash` | `gemini-3.5`, `flash-3.5` | 1M | 65K | Frontier agentic/coding at Flash speed |
|
|
394
|
+
| `gemini-2.5-pro` | `pro 2.5` | 1M | 65K | Deep reasoning with thinking budget |
|
|
395
|
+
| `gemini-2.5-flash` | `flash` | 1M | 65K | Ultra-fast |
|
|
396
|
+
| `gemini-2.5-flash-lite` | `flash-lite` | 1M | 65K | Lightweight fast model |
|
|
397
|
+
|
|
398
|
+
**Note:** The short name `gemini` (and `gemini:pro` / `gemini:flash`) routes to the **Antigravity CLI** (`agy`, OAuth-based). For Google API access, use specific model names like `gemini-3.1-pro-preview` or `gemini-2.5-flash` (bare `gemini-pro` / `gemini-flash` also route to the Google API).
|
|
399
|
+
|
|
400
|
+
### X.AI / Grok Models
|
|
401
|
+
|
|
402
|
+
| Model | Aliases | Context | Notes |
|
|
403
|
+
|-------|---------|---------|-------|
|
|
404
|
+
| `grok-4.5` | `grok`, `grok-4.5-latest`, `grok-build-latest` | 500K | Flagship: image input, reasoning content, native web/X search via Agent Tools |
|
|
405
|
+
|
|
406
|
+
`reasoning_effort` maps to Grok's `low`/`medium`/`high`; Grok 4.5 always reasons and cannot be disabled. Web search is attached automatically and the model decides whether to use it.
|
|
407
|
+
|
|
408
|
+
### Anthropic Models (API-based)
|
|
409
|
+
|
|
410
|
+
| Model | Aliases | Context | Output | Notes |
|
|
411
|
+
|-------|---------|---------|--------|-------|
|
|
412
|
+
| `claude-fable-5` | `fable`, `fable-5` | 1M | 128K | Most capable, adaptive thinking + effort, images, caching, compaction |
|
|
413
|
+
| `claude-opus-4-8` | `opus`, `opus-4.8` | 200K (1M beta) | 128K | Complex reasoning and agentic coding |
|
|
414
|
+
| `claude-opus-4-7`, `claude-opus-4-6` | `opus-4.7`, `opus-4.6` | 200K (1M beta) | 128K | Previous Opus generations |
|
|
415
|
+
| `claude-opus-4-5-20251101`, `claude-opus-4-1-20250805` | `opus-4.5`, `opus-4.1` | 200K | 64K / 32K | Earlier Opus tiers |
|
|
416
|
+
| `claude-sonnet-4-6` | `sonnet`, `sonnet-4.6` | 200K (1M beta) | 64K | Best speed/intelligence balance, adaptive thinking |
|
|
417
|
+
| `claude-haiku-4-5-20251001` | `haiku`, `haiku-4.5` | 200K | 64K | Fast and intelligent |
|
|
418
|
+
|
|
419
|
+
Models with adaptive thinking control depth via `reasoning_effort`, which maps to Anthropic's `effort` parameter. System prompts are automatically cached for 1 hour; cache stats appear in response metadata as `cache_creation_input_tokens` / `cache_read_input_tokens`.
|
|
420
|
+
|
|
421
|
+
### Mistral Models
|
|
422
|
+
|
|
423
|
+
| Model | Aliases | Context | Notes |
|
|
424
|
+
|-------|---------|---------|-------|
|
|
425
|
+
| `mistral-medium-3-5` | `mistral`, `mistral-medium` | 256K | Frontier-class multimodal, adjustable reasoning |
|
|
426
|
+
| `mistral-small-2603` | `mistral-small` | 256K | Hybrid multimodal (instruct + reasoning + coding) |
|
|
427
|
+
| `mistral-large-2512` | `mistral-large` | 256K | Open-weight MoE flagship, image-capable, no adjustable reasoning |
|
|
428
|
+
|
|
429
|
+
`reasoning_effort` maps to `high` (any enabled level) or `none` on Medium 3.5 and Small; Large has no adjustable reasoning.
|
|
430
|
+
|
|
431
|
+
### DeepSeek Models
|
|
432
|
+
|
|
433
|
+
| Model | Aliases | Context | Output | Notes |
|
|
434
|
+
|-------|---------|---------|--------|-------|
|
|
435
|
+
| `deepseek-v4-pro` | `deepseek`, `deepseek-pro` | 1M | 384K | Flagship MoE, thinking mode, text-only |
|
|
436
|
+
| `deepseek-v4-flash` | `deepseek-flash` | 1M | 384K | Faster, lower-cost V4 tier, text-only |
|
|
437
|
+
|
|
438
|
+
`reasoning_effort`: `none` disables thinking; enabled levels use `high`; `max` uses `max`.
|
|
439
|
+
|
|
440
|
+
### OpenRouter Models
|
|
441
|
+
|
|
442
|
+
| Model | Aliases | Context | Notes |
|
|
443
|
+
|-------|---------|---------|-------|
|
|
444
|
+
| `z-ai/glm-5.2` | `glm`, `glm-5.2` | 1M | Large-scale reasoning, text-only, default OpenRouter model |
|
|
445
|
+
| `deepseek/deepseek-v4-pro`, `deepseek/deepseek-v4-flash` | — | 1M | DeepSeek V4 tiers, text-only |
|
|
446
|
+
| `qwen/qwen3.7-max` | `qwen3.7-max` | 1M | Flagship Qwen, text-only |
|
|
447
|
+
| `qwen/qwen3.7-plus` | `qwen3.7-plus` | 1M | Image-capable Qwen |
|
|
448
|
+
| `moonshotai/kimi-k2.7-code` | `kimi-k2.7-code` | 256K | Coding model, image-capable, reasoning always on |
|
|
449
|
+
| `moonshotai/kimi-k2.6` | `kimi-k2.6` | 256K | Image-capable general model |
|
|
450
|
+
| `openrouter/auto` | `auto-router`, `openrouter-auto` | — | Auto-selects the best model for the prompt |
|
|
451
|
+
|
|
452
|
+
Any other model works via its full `provider/model` slug (e.g. `anthropic/claude-sonnet-5`) or the `openrouter:` namespace. Append `:online` to a slug (e.g. `z-ai/glm-5.2:online`) to opt into web search, which adds a real per-request cost.
|
|
453
|
+
|
|
454
|
+
### Codex (agentic, local)
|
|
455
|
+
|
|
456
|
+
**Codex** is an agentic coding assistant with direct filesystem access:
|
|
457
|
+
|
|
458
|
+
- **Model**: `codex` (underlying model: GPT-5.6)
|
|
459
|
+
- **Thread-based sessions**: persistent conversation history via `continuation_id` in `chat` mode
|
|
460
|
+
- **Direct file access**: reads files from the working directory (paths relative to `CLIENT_CWD`)
|
|
461
|
+
- **Response times**: 6-20 seconds typical (complex tasks may take minutes)
|
|
462
|
+
- **Authentication**: ChatGPT login OR `CODEX_API_KEY` (NOT `OPENAI_API_KEY`)
|
|
463
|
+
- `reasoning_effort` and web search are not applicable — Codex manages its own execution
|
|
464
|
+
|
|
465
|
+
### Claude Agent SDK (subscription)
|
|
466
|
+
|
|
467
|
+
**Claude** is available through the Claude Agent SDK, using Claude Code CLI authentication instead of an API key:
|
|
468
|
+
|
|
469
|
+
- **Model**: `claude` (aliases: `claude-sdk`, `claude-code`) — defaults to Claude Fable 5
|
|
470
|
+
- **Model selection**: `claude:fable` (Claude Fable 5) or `claude:opus` (Claude Opus 4.8); unknown `claude:`-prefixed names pass through to the SDK (e.g. `claude:claude-sonnet-4-6`)
|
|
471
|
+
- **Authentication**: `claude login` — no `ANTHROPIC_API_KEY` needed
|
|
472
|
+
- **Direct file access**: reads files from the working directory
|
|
473
|
+
- `reasoning_effort` and sampling parameters are managed by the SDK
|
|
474
|
+
|
|
475
|
+
### Gemini via Antigravity CLI (subscription)
|
|
476
|
+
|
|
477
|
+
The **Antigravity CLI** (`agy`) provides subscription-based access to Gemini models through Google OAuth:
|
|
478
|
+
|
|
479
|
+
- **Models** (text-only): `gemini` (= `gemini:pro`, Gemini 3.1 Pro), `gemini:flash` (Gemini 3.5 Flash)
|
|
480
|
+
- **Authentication**: Google OAuth via `agy` (one-time interactive login)
|
|
481
|
+
- **Setup**: install the Antigravity CLI and run `agy` once to log in
|
|
482
|
+
- **Billing**: uses your Antigravity subscription/compute allowance instead of API credits
|
|
483
|
+
- **Reasoning effort**: `low`/`medium`/`high`/`max` select the model variant
|
|
484
|
+
- **Context**: 1M tokens
|
|
485
|
+
- One-shot responses (no token-level streaming); ~7s minimum per call
|
|
486
|
+
|
|
487
|
+
**Authentication Setup:**
|
|
488
|
+
```bash
|
|
489
|
+
# Install the Antigravity CLI (agy)
|
|
490
|
+
# Windows (PowerShell):
|
|
491
|
+
irm https://antigravity.google/cli/install.ps1 | iex
|
|
492
|
+
# macOS/Linux:
|
|
493
|
+
curl -fsSL https://antigravity.google/cli/install.sh | bash
|
|
494
|
+
|
|
495
|
+
# Run interactive login (one-time) — also establishes workspace trust
|
|
496
|
+
agy
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
### GitHub Copilot SDK (subscription)
|
|
500
|
+
|
|
501
|
+
Reach these with the `copilot:` namespace (e.g. `copilot:gpt-5.6-terra`); uses your GitHub Copilot subscription (`gh auth login`) — no API key needed:
|
|
502
|
+
|
|
503
|
+
- **OpenAI**: `gpt-5.6-sol` (aliases: `gpt-5.6`, `gpt-5`), `gpt-5.6-terra`, `gpt-5.6-luna` (all accept `reasoning_effort`)
|
|
504
|
+
- **Anthropic**: `claude-fable-5` (alias: `fable`), `claude-sonnet-5` (alias: `sonnet`), `claude-opus-4.8` (aliases: `opus`, `claude`)
|
|
505
|
+
- **Google**: `gemini-3.1-pro-preview` (aliases: `gemini`, `gemini-3.1-pro`), `gemini-3.5-flash` (alias: `gemini-flash`)
|
|
506
|
+
- Any other `copilot:<id>` is forwarded to the Copilot backend verbatim
|
|
507
|
+
|
|
508
|
+
### Model Selection
|
|
509
|
+
|
|
510
|
+
Use `"auto"` for automatic selection, or specify exact models:
|
|
511
|
+
|
|
512
|
+
```text
|
|
513
|
+
"auto" // First available provider (chat); first 3 (consensus)
|
|
514
|
+
"gpt-5.6" // OpenAI flagship
|
|
515
|
+
"gemini-2.5-flash" // Google API
|
|
516
|
+
"grok-4.5" // X.AI
|
|
517
|
+
"deepseek" // DeepSeek (-> deepseek-v4-pro)
|
|
518
|
+
"mistral" // Mistral (-> mistral-medium-3-5)
|
|
519
|
+
"z-ai/glm-5.2" // OpenRouter (full slug)
|
|
520
|
+
"z-ai/glm-5.2:online" // OpenRouter with web search opt-in
|
|
521
|
+
"fable" // Anthropic API (-> claude-fable-5)
|
|
522
|
+
"opus" // Anthropic API (-> claude-opus-4-8)
|
|
523
|
+
"claude" // Claude Agent SDK (-> Claude Fable 5)
|
|
524
|
+
"claude:opus" // Claude Agent SDK (Claude Opus 4.8)
|
|
525
|
+
"gemini" // Antigravity CLI (Gemini 3.1 Pro)
|
|
526
|
+
"copilot:gpt-5.6-terra" // GitHub Copilot SDK
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Auto behavior:**
|
|
530
|
+
- **chat mode**: `["auto"]` selects the first available provider and uses its default model, with failover to the next provider on error.
|
|
531
|
+
- **consensus mode**: `["auto"]` expands to the first 3 available providers.
|
|
532
|
+
|
|
533
|
+
Provider auto-selection priority (subscription-based CLI/SDK providers first, then API-key providers): `codex`, `gemini-cli`, `claude`, `copilot`, `openai`, `google`, `xai`, `anthropic`, `mistral`, `deepseek`, `openrouter`.
|
|
534
|
+
|
|
535
|
+
## Configuration
|
|
536
|
+
|
|
537
|
+
### AI Summarization
|
|
538
|
+
|
|
539
|
+
```bash
|
|
540
|
+
ENABLE_RESPONSE_SUMMARIZATION=true # Enable AI-generated titles and summaries (default: false)
|
|
541
|
+
SUMMARIZATION_MODEL=gpt-5-nano # Model used for summarization (default: gpt-5-nano)
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
When enabled: title generation (up to 60 chars) per request, streaming progress summaries during async jobs, 1-2 sentence final summaries, and enhanced `check_status` display. Summarization is non-blocking — failures fall back to text snippets and never affect the main flow.
|
|
545
|
+
|
|
546
|
+
### Codex Configuration
|
|
547
|
+
|
|
548
|
+
Control Codex behavior through environment variables:
|
|
549
|
+
|
|
550
|
+
- **`CODEX_SANDBOX_MODE`** — filesystem access: `read-only` (default), `workspace-write`, `danger-full-access` (containers only)
|
|
551
|
+
- **`CODEX_SKIP_GIT_CHECK`** — `true` (default) works in any directory; `false` requires a Git repository
|
|
552
|
+
- **`CODEX_APPROVAL_POLICY`** — `never` (default, recommended for servers), `untrusted`, `on-failure`, `on-request`
|
|
553
|
+
- **`CODEX_MODEL`** — underlying model for Codex sessions (default: `gpt-5.6-sol`)
|
|
554
|
+
- **`CODEX_API_KEY`** — optional API key for headless deployments (alternative to ChatGPT login)
|
|
555
|
+
|
|
556
|
+
**Example (.env):**
|
|
557
|
+
```bash
|
|
558
|
+
CODEX_API_KEY=your_codex_api_key_here
|
|
559
|
+
CODEX_SANDBOX_MODE=read-only
|
|
560
|
+
CODEX_SKIP_GIT_CHECK=true
|
|
561
|
+
CODEX_APPROVAL_POLICY=never
|
|
562
|
+
CODEX_MODEL=gpt-5.6-sol
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
## Context Processing
|
|
566
|
+
|
|
567
|
+
### File Support
|
|
568
|
+
|
|
569
|
+
**Supported text formats:** `.txt`, `.md`, `.js`, `.ts`, `.json`, `.yaml`, `.yml`, `.py`, `.java`, `.c`, `.cpp`, `.h`, `.css`, `.html`, `.xml`, `.csv`, `.sql`, `.sh`, `.bat`, `.log`
|
|
570
|
+
|
|
571
|
+
**Supported image formats:** `.jpg`, `.jpeg`, `.png`, `.gif`, `.webp`, `.bmp`
|
|
572
|
+
|
|
573
|
+
**Size limits:** text files 1MB default; image files 10MB default
|
|
574
|
+
|
|
575
|
+
### File Processing
|
|
576
|
+
|
|
577
|
+
Provide paths in the `files` array. Line ranges are supported: `file.txt{10:50}` for lines 10-50, `file.txt{100:}` from line 100 onward.
|
|
578
|
+
|
|
579
|
+
```json
|
|
580
|
+
{
|
|
581
|
+
"files": [
|
|
582
|
+
"/absolute/path/to/file.js",
|
|
583
|
+
"./relative/path/to/file.md{1:80}"
|
|
584
|
+
]
|
|
585
|
+
}
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
The processed context includes file content with line numbers and metadata (size, last modified) and reports inaccessible files as errors.
|
|
589
|
+
|
|
590
|
+
### Image Processing
|
|
591
|
+
|
|
592
|
+
```json
|
|
593
|
+
{
|
|
594
|
+
"images": [
|
|
595
|
+
"/path/to/diagram.png",
|
|
596
|
+
"data:image/jpeg;base64,/9j/4AAQ..."
|
|
597
|
+
]
|
|
598
|
+
}
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
Images are base64-encoded and sent to models that support vision. When a request includes images, `"auto"` selection skips text-only providers.
|
|
602
|
+
|
|
603
|
+
## Continuation System
|
|
604
|
+
|
|
605
|
+
The first request creates a continuation automatically and returns its ID; pass it back on subsequent requests to continue the thread. The continuation persists across modes — you may switch `mode` and `models` on a resuming turn, and the shared transcript is the context. Custom continuation IDs are accepted (letters, numbers, hyphens, underscores; max 128 chars). Conversations expire after 24 hours of inactivity.
|
|
606
|
+
|
|
607
|
+
```json
|
|
608
|
+
// First request (no continuation_id)
|
|
609
|
+
{ "prompt": "Start a discussion about architecture", "models": ["auto"] }
|
|
610
|
+
|
|
611
|
+
// Follow-up (reuse the returned id)
|
|
612
|
+
{ "prompt": "What about microservices?", "continuation_id": "conv_abc123" }
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
## Asynchronous Execution
|
|
616
|
+
|
|
617
|
+
Set `async: true` on a chat request for long-running work:
|
|
618
|
+
|
|
619
|
+
1. **Immediate response**: returns a `continuation_id` instantly.
|
|
620
|
+
2. **Background processing**: the job runs with streaming support.
|
|
621
|
+
3. **Status monitoring**: poll with `check_status`.
|
|
622
|
+
4. **Result retrieval**: full results (answer or transcript) available when the job completes.
|
|
623
|
+
5. **Cancellation**: use `cancel_job` to stop a running job.
|
|
624
|
+
|
|
625
|
+
### Status Types
|
|
626
|
+
|
|
627
|
+
| Status | Description | Actions Available |
|
|
628
|
+
|--------|-------------|-------------------|
|
|
629
|
+
| `processing` | Job is running | Cancel, Check Status |
|
|
630
|
+
| `completed` | Job finished successfully | Get Results |
|
|
631
|
+
| `failed` | Job encountered an error | Check Error Details |
|
|
632
|
+
| `cancelled` | Job was cancelled | None |
|
|
633
|
+
|
|
634
|
+
### Caching
|
|
635
|
+
|
|
636
|
+
- **Memory cache (24 hours)**: active jobs and recent completions for fast status lookups.
|
|
637
|
+
- **Disk cache (3 days)**: long-term result storage that survives server restarts.
|
|
638
|
+
|
|
639
|
+
### When to Use Async
|
|
640
|
+
|
|
641
|
+
- Long analysis tasks (>30 seconds)
|
|
642
|
+
- Large file processing
|
|
643
|
+
- Multi-model consensus or multi-lap roundtables
|
|
644
|
+
- Deep-research and other long-running models
|
|
645
|
+
|
|
646
|
+
## Error Handling
|
|
647
|
+
|
|
648
|
+
**Missing API key / unavailable provider:**
|
|
649
|
+
```json
|
|
650
|
+
{ "error": "Provider openai is not available. Check API key configuration." }
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
**Invalid model:**
|
|
654
|
+
```json
|
|
655
|
+
{ "error": "Provider not found for model: invalid-model" }
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
**All models failed (multi-model chat):** the error lists each model and its failure. In consensus/roundtable, individual model/turn failures are recorded in the result (`failed` entries and trailing failure details) rather than aborting the whole request.
|
|
659
|
+
|
|
660
|
+
## Authentication
|
|
661
|
+
|
|
662
|
+
**Environment variables:**
|
|
663
|
+
```bash
|
|
664
|
+
OPENAI_API_KEY=sk-proj-...
|
|
665
|
+
GOOGLE_API_KEY=AIzaSy... # or GEMINI_API_KEY (GEMINI_API_KEY takes priority)
|
|
666
|
+
XAI_API_KEY=xai-...
|
|
667
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
668
|
+
MISTRAL_API_KEY=...
|
|
669
|
+
DEEPSEEK_API_KEY=...
|
|
670
|
+
OPENROUTER_API_KEY=sk-or-...
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**MCP client configuration:**
|
|
674
|
+
```json
|
|
675
|
+
{
|
|
676
|
+
"env": {
|
|
677
|
+
"OPENAI_API_KEY": "sk-proj-...",
|
|
678
|
+
"GOOGLE_API_KEY": "AIzaSy...",
|
|
679
|
+
"XAI_API_KEY": "xai-..."
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
Subscription providers (Codex, Claude Agent SDK, Antigravity CLI, Copilot SDK) use local CLI authentication instead of API keys — see [PROVIDERS.md](PROVIDERS.md).
|
|
685
|
+
|
|
686
|
+
### Security
|
|
687
|
+
|
|
688
|
+
- API keys are never logged or exposed
|
|
689
|
+
- Path traversal protection for file access
|
|
690
|
+
- File access limited to allowed directories
|
|
691
|
+
- Input validation on all parameters
|
|
692
|
+
|
|
693
|
+
## Server Limits
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
MAX_MCP_OUTPUT_TOKENS=200000 # Max output tokens (default 25,000)
|
|
697
|
+
```
|
|
698
|
+
|
|
699
|
+
Response bodies are token-limited to fit the configured MCP output ceiling.
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
For usage examples across common scenarios, see [EXAMPLES.md](EXAMPLES.md).
|