Spaces:
Running

File size: 79,081 Bytes
a5530ef
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d123f
b4c277b
68d123f
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
 
b4c277b
 
 
68d123f
 
 
 
b4c277b
 
80490af
b4c277b
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
 
 
b4c277b
 
 
 
 
80490af
b4c277b
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
 
b4c277b
 
 
 
80490af
b4c277b
 
 
 
 
80490af
 
 
b4c277b
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80490af
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68d123f
b4c277b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a5530ef
1
2
3
4
5
6
7
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>MCP primitive versioning proposal</title>
<link rel="icon" href="data:,">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root {
  --bg: #FFFFFF;
  --surface: #F8FAFC;
  --surface-subtle: #F1F5F9;
  --ink: #0F172A;
  --ink-secondary: #334155;
  --mute: #475569;
  --rule: #E2E8F0;
  --rule-strong: #CBD5E1;

  --accent: #1D4ED8;
  --accent-tint: #EFF6FF;

  --ok: #15803D;
  --bad: #B91C1C;
  --bad-tint: #FEF2F2;
  --warn: #B45309;
  --warn-tint: #FFFBEB;

  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Strict 3-size body scale below H1 */
  --text-lg: 1.1875rem;   /* 19px: section headings */
  --text-body: 0.9375rem; /* 15px: all body prose, lists, item titles */
  --text-sm: 0.8125rem;   /* 13px: controls, code, notes, diagram text */
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--text-body);
  line-height: 1.55;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(29, 78, 216, 0.35);
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-color: var(--accent);
}

code, pre {
  font-family: var(--mono);
  font-size: var(--text-sm);
}

code {
  background: var(--surface-subtle);
  color: var(--ink);
  padding: 0.08em 0.32em;
  border-radius: 3px;
}

a code {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 28px 56px;
}

/* Header & Navigation */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0 12px;
}

.masthead h1 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--ink);
}

.control-pair {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.control-label {
  font-size: var(--text-sm);
  color: var(--mute);
  font-weight: 500;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  background: var(--surface-subtle);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--rule);
}

.segmented button {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--mute);
  padding: 4px 11px;
  border-radius: 4px;
  white-space: nowrap;
  transition: background-color 160ms cubic-bezier(0.22, 1, 0.36, 1),
              color 160ms cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-checked="true"] {
  background: var(--bg);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.07);
}

/* Primary Tabs */
.tabbar {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}

.tabbar button {
  position: relative;
  padding: 8px 0 10px;
  font-size: var(--text-body);
  font-weight: 500;
  color: var(--mute);
  transition: color 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tabbar button:hover {
  color: var(--ink);
}

.tabbar button[aria-selected="true"] {
  color: var(--ink);
  font-weight: 600;
}

.tabbar button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.tabpanel[hidden] {
  display: none;
}

/* Intro prose */
.opening-prose {
  max-width: 68ch;
  margin: 0 0 18px;
  color: var(--ink-secondary);
}

.opening-prose p {
  margin: 0;
}

.opening-prose p + p {
  margin-top: 10px;
  color: var(--ink);
}

.opening-prose strong {
  color: var(--ink);
  font-weight: 600;
}

/* Section structure */
.section-block {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h3 {
  margin: 0;
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

/* Silent drift 3-column horizontal flow */
.drift-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) 38px minmax(0, 1fr) 38px minmax(0, 1.2fr);
  align-items: stretch;
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.flow-step {
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.flow-step-title {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink);
}

.flow-detail {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--ink-secondary);
  line-height: 1.5;
}

.flow-detail strong {
  color: var(--ink);
  font-weight: 600;
}

.flow-code {
  font-family: var(--mono);
  font-size: var(--text-sm);
  color: var(--ink);
  background: var(--bg);
  border-left: 2px solid var(--rule-strong);
  padding: 5px 9px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.flow-code.is-amber {
  background: var(--warn-tint);
  border-left-color: var(--warn);
  color: var(--warn);
  font-weight: 500;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  background: var(--bg);
}

.flow-outcome {
  border-left: 3px solid var(--bad);
  background: var(--bad-tint);
  transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.flow-outcome.is-amber-mismatch {
  border-left-color: var(--warn);
  background: var(--warn-tint);
}

.outcome-verdict {
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--bad);
}

.flow-outcome.is-amber-mismatch .outcome-verdict {
  color: var(--warn);
}

.drift-footnote {
  margin: 11px 0 0;
  font-size: var(--text-sm);
  color: var(--mute);
  max-width: 82ch;
}

.drift-footnote strong {
  color: var(--ink);
  font-weight: 600;
}

/* 3-column hairline grid (Why caching isn't enough) */
.three-col-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.hairline-col {
  padding: 14px 16px 15px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.hairline-col + .hairline-col {
  padding: 14px 16px 15px 16px;
  border-left: 1px solid var(--rule);
}



.hairline-col:last-child {
  padding-right: 0;
}

.hairline-col p {
  margin: 0;
  color: var(--ink-secondary);
}

/* 2x2 typographic hairline grid (Requirements) */
.req-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  border-top: 1px solid var(--rule-strong);
  border-bottom: 1px solid var(--rule);
}

.req-cell {
  padding: 14px 24px 15px 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.req-cell:nth-child(even) {
  padding: 14px 0 15px 24px;
  border-left: 1px solid var(--rule);
}

.req-cell:nth-child(n + 3) {
  border-top: 1px solid var(--rule);
}

.req-cell p {
  margin: 0;
  color: var(--ink-secondary);
}

/* Footer note */
.guardrails {
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
}

.guardrail-note {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--mute);
  line-height: 1.55;
}

.guardrail-note strong {
  color: var(--ink);
  font-weight: 600;
}

/* Tab 2: Topologies */
.topo-intro {
  max-width: 68ch;
  margin: 0 0 20px;
  color: var(--ink-secondary);
}

.topo-intro strong {
  color: var(--ink);
  font-weight: 600;
}

.topo-row {
  padding: 22px 0 26px;
  border-top: 1px solid var(--rule);
}

.topo-row h2 {
  margin-bottom: 13px;
}

.diagram-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 13px;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
}

.diagram-wrap svg {
  width: 100%;
  min-width: 1024px;
  height: auto;
  display: block;
}

.row-captions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
}

.caption-item {
  margin: 0;
  color: var(--ink-secondary);
}

.caption-item strong {
  color: var(--ink);
  font-weight: 600;
}

.topo-closing {
  margin: 4px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule-strong);
  color: var(--ink-secondary);
}

.topo-closing p {
  margin: 0;
  max-width: 72ch;
}

.topo-closing strong {
  color: var(--ink);
  font-weight: 600;
}

@media (max-width: 820px) {
  .masthead {
    flex-direction: column;
    align-items: flex-start;
  }

  .drift-flow {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    height: 30px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
  }

  .flow-arrow svg {
    transform: rotate(90deg);
  }

  .three-col-grid,
  .req-grid,
  .guardrails,
  .row-captions {
    grid-template-columns: 1fr;
  }

  .hairline-col,
  .hairline-col + .hairline-col {
    padding: 14px 0;
    border-left: 0;
  }

  .hairline-col + .hairline-col {
    border-top: 1px solid var(--rule);
  }

  .req-cell,
  .req-cell:nth-child(even) {
    padding: 14px 0;
    border-left: 0;
  }

  .req-cell + .req-cell {
    border-top: 1px solid var(--rule);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Proposed solution & At scale tabs */
.sol-lead { max-width: 68ch; margin: 0 0 22px; }
.sol-lead p { margin: 0 0 10px; color: var(--ink-secondary); }
.sol-lead p:last-child { margin-bottom: 0; color: var(--ink); font-weight: 500; }

.sol-block { padding: 20px 0 0; border-top: 1px solid var(--rule); }
.sol-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sol-block-head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}
.sol-intro { margin: 0 0 16px; max-width: 70ch; color: var(--ink-secondary); }

.sol-diagram-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  padding: 14px 16px;
}
.sol-diagram-wrap svg { display: block; width: 100%; min-width: 820px; height: auto; }

.outcomes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 18px;
}
.outcome-col { padding: 16px 18px; }
.outcome-col + .outcome-col { border-left: 1px solid var(--rule); }
.outcome-col:first-child { padding-left: 0; }
.outcome-col:last-child { padding-right: 0; }
.outcome-col h3 {
  margin: 0 0 6px;
  font-size: var(--text-body);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-mute { background: var(--mute); }
.outcome-col p { margin: 0 0 8px; font-size: var(--text-sm); color: var(--ink-secondary); }
.outcome-col p:last-child { margin-bottom: 0; }
.outcome-meta { font-family: var(--mono); font-size: 12px; color: var(--mute); }

.catalog-stage {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  padding: 16px 18px;
}
.catalog-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.blast-stat { font-size: var(--text-body); font-weight: 600; }
.blast-stat.is-warn { color: var(--warn); }
.blast-stat.is-ok { color: var(--ok); }
.legend-inline {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--mute);
}
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 11px; height: 11px; border-radius: 2px; border: 1px solid; display: inline-block; }
.sw-ok { background: #F0FDF4; border-color: #86EFAC; }
.sw-warn { background: var(--warn-tint); border-color: #FCD34D; }
.sw-bad { background: var(--bad-tint); border-color: #F87171; }

.groups-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tool-group {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 10px 12px;
}
.tool-group.has-change { border-color: #FECACA; }
.tool-group.all-stale { border-color: #FDE68A; }
.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.group-name { font-size: var(--text-sm); font-weight: 600; color: var(--ink); }
.group-count { font: 500 12px var(--mono); color: var(--mute); font-variant-numeric: tabular-nums; }
.tile-row { display: flex; flex-wrap: wrap; gap: 4px; }
.tile {
  height: 20px;
  min-width: 24px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid;
  font: 500 11px/18px var(--mono);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
}
.tile.t-ok { background: #F0FDF4; border-color: #86EFAC; color: #166534; }
.tile.t-warn { background: var(--warn-tint); border-color: #FCD34D; color: #92400E; }
.tile.t-bad { background: var(--bad-tint); border-color: #F87171; color: #991B1B; font-weight: 600; }
.tile.t-named { padding: 0 6px; }

.tradeoff-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-top: 18px;
}
.tradeoff-col { padding: 16px 20px; }
.tradeoff-col + .tradeoff-col { border-left: 1px solid var(--rule); }
.tradeoff-col:first-child { padding-left: 0; }
.tradeoff-col:last-child { padding-right: 0; }
.tradeoff-col h3 { margin: 0 0 6px; font-size: var(--text-body); font-weight: 600; }
.tradeoff-col p { margin: 0 0 8px; font-size: var(--text-sm); color: var(--ink-secondary); }
.tradeoff-col p:last-child { margin-bottom: 0; }

details.wire-details { margin-top: 18px; border-top: 1px solid var(--rule); padding-top: 14px; }
details.wire-details summary {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
details.wire-details summary::-webkit-details-marker { display: none; }
.wire-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.wire-pane h4 { margin: 0 0 6px; font-size: var(--text-sm); font-weight: 600; color: var(--ink-secondary); }
.wire-pane pre {
  margin: 0;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  overflow-x: auto;
  color: var(--ink);
}
.wire-pane pre .hl { background: var(--warn-tint); color: var(--warn); font-weight: 500; }

@media (max-width: 860px) {
  .outcomes-grid, .groups-grid, .tradeoff-grid, .wire-grid { grid-template-columns: 1fr; }
  .outcome-col, .tradeoff-col { padding: 14px 0; }
  .outcome-col + .outcome-col, .tradeoff-col + .tradeoff-col { border-left: 0; border-top: 1px solid var(--rule); }
}

</style>
</head>
<body>
<div class="page">
  <header class="masthead">
    <h1>MCP primitive versioning proposal</h1>
    <div class="control-pair">
      <span class="control-label" id="example-label">Hypothetical example</span>
      <div class="segmented" role="radiogroup" aria-labelledby="example-label">
        <button type="button" role="radio" aria-checked="false" data-example="minimal">Minimal</button>
        <button type="button" role="radio" aria-checked="true" data-example="hf">Hugging Face MCP</button>
        <button type="button" role="radio" aria-checked="false" data-example="db">Database Toolbox</button>
      </div>
    </div>
  </header>

  <nav class="tabbar" role="tablist" aria-label="Primitive versioning problem views">
    <button type="button" role="tab" id="tab-btn-problem" aria-controls="panel-problem" aria-selected="true" data-tab="problem">The core problem</button>
    <button type="button" role="tab" id="tab-btn-topologies" aria-controls="panel-topologies" aria-selected="false" data-tab="topologies">Where mismatches happen</button>
    <button type="button" role="tab" id="tab-btn-solution" aria-controls="panel-solution" aria-selected="false" data-tab="solution">Proposed solution</button>
    <button type="button" role="tab" id="tab-btn-scale" aria-controls="panel-scale" aria-selected="false" data-tab="scale">At scale: per-tool tags</button>
  </nav>

  <!-- TAB 1: THE CORE PROBLEM -->
  <section class="tabpanel" id="panel-problem" role="tabpanel" aria-labelledby="tab-btn-problem">
    <div class="opening-prose">
      <p>
        Clients discover a tool once and invoke it later &mdash; across a TTL cache (<code>ttlMs</code>), a saved startup cache, or a pause for user approval. A call can satisfy the current input schema even when an argument&rsquo;s meaning or the tool&rsquo;s UI metadata has changed.
      </p>
      <p>
        <strong>An ordinary <code>tools/call</code> request does not reliably identify the definition the client used.</strong>
      </p>
    </div>

    <!-- Interactive Silent Drift Diagram -->
    <div class="section-block">
      <div class="section-head">
        <h2>Silent drift on a valid call</h2>
        <div class="segmented" role="radiogroup" aria-label="Silent drift variant">
          <button type="button" role="radio" aria-checked="true" data-drift="unit">Unit / behavior change</button>
          <button type="button" role="radio" aria-checked="false" data-drift="metadata">Metadata-only change</button>
          <button type="button" role="radio" aria-checked="false" data-drift="approval">Paused for approval</button>
        </div>
      </div>

      <div class="drift-flow" id="drift-diagram">
        <div class="flow-step">
          <div class="flow-step-title">Client prepared from v1</div>
          <p class="flow-detail" id="d-client-desc"></p>
          <div class="flow-code" id="d-client-code"></div>
        </div>
        <div class="flow-arrow" aria-hidden="true">
          <svg width="24" height="14" viewBox="0 0 24 14" fill="none">
            <path d="M1 7H21M21 7L16 2M21 7L16 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
        </div>
        <div class="flow-step">
          <div class="flow-step-title">On the wire</div>
          <div class="flow-code" id="d-wire-code"></div>
          <p class="flow-detail" id="d-wire-desc"></p>
        </div>
        <div class="flow-arrow" aria-hidden="true">
          <svg width="24" height="14" viewBox="0 0 24 14" fill="none">
            <path d="M1 7H21M21 7L16 2M21 7L16 12" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
          </svg>
        </div>
        <div class="flow-step flow-outcome" id="d-server-box">
          <div class="flow-step-title">Server now runs v2</div>
          <div class="outcome-verdict" id="d-server-verdict"></div>
          <p class="flow-detail" id="d-server-desc"></p>
        </div>
      </div>

      <p class="drift-footnote">
        <strong>Chained tools and outputs too:</strong> A change to one tool can silently break another (e.g., Tool A returns dollars while Tool B switches to cents). The server can also return <code>structuredContent</code> that matches its new <code>outputSchema</code> but fails validation against the client&rsquo;s cached schema, after the side effect has occurred.
      </p>
    </div>

    <!-- Why caching, TTLs, and notifications aren't enough -->
    <div class="section-block">
      <div class="section-head">
        <h2>Why caching, TTLs, and notifications aren&rsquo;t enough</h2>
      </div>
      <div class="three-col-grid">
        <div class="hairline-col">
          <h3>TTLs are hints, not guarantees</h3>
          <p>
            <code>ttlMs</code> hints how long a result may be treated as fresh; the definition may change sooner. <code>cacheScope</code> controls who may reuse it. Clients also reuse persisted lists at startup without re-checking freshness to cut latency.
          </p>
        </div>
        <div class="hairline-col">
          <h3>Notifications miss rollouts and still race</h3>
          <p>
            <code>subscriptions/<wbr>listen</code> is a long-held stream pinned to one replica and drained last during a rolling deploy, while <code>tools/call</code> already hits new pods &mdash; and reconnecting carries no prior state. Even when <code>list_changed</code> arrives, definitions can still change between lookup and call.
          </p>
        </div>
        <div class="hairline-col">
          <h3>Prepared work outlives the cache</h3>
          <p>
            A call awaiting user approval still reflects the old definition even if a background refresh updates the client&rsquo;s cached list to <code>v2</code> before the user clicks Approve.
          </p>
        </div>
      </div>
    </div>

    <!-- What a solution must do for a prepared call -->
    <div class="section-block">
      <div class="section-head">
        <h2>What a solution must do for a prepared call</h2>
      </div>
      <div class="req-grid">
        <div class="req-cell">
          <h3>Identify the definition used to prepare a call</h3>
          <p>
            Keep the original definition reference when the cache refreshes. Distinguish a missing reference from one the service cannot honor.
          </p>
        </div>
        <div class="req-cell">
          <h3>Detect mismatches before execution</h3>
          <p>
            Allow the service to honor a compatible call, route it to a replica that supports that definition, or reject it before running side effects.
          </p>
        </div>
        <div class="req-cell">
          <h3>Separate &ldquo;succeeded, refresh later&rdquo; from &ldquo;rejected before execution&rdquo;</h3>
          <p>
            Keep compatible and unrelated calls working while signaling staleness, so clients know when to refresh without repeating an operation that already ran.
          </p>
        </div>
        <div class="req-cell">
          <h3>Distinguish definition mismatch from bad arguments</h3>
          <p>
            Give clients a distinct mismatch error so they can refresh and replan, with identical behavior across every transport &mdash; including stdio without HTTP headers.
          </p>
        </div>
      </div>
      <p class="drift-footnote">
        <strong>Catalog consistency too:</strong> During discovery, clients also need a way to detect mixed pages across a paginated catalog and prevent a delayed response from overwriting a completed refresh.
      </p>
    </div>

    <footer class="guardrails">
      <p class="guardrail-note">
        <strong>Beyond tools:</strong> The same gap affects <code>prompts</code> (arguments added while a user fills out a form), <code>resource</code> URI templates, and <code>skills/list</code> (Skills extension) &mdash; where a skill definition can change across reads separately from referenced files already checked via manifest digests.
      </p>
      <p class="guardrail-note">
        <strong>Scope &amp; wire design:</strong> This page covers the core problem statement (<a href="problem-statement.md"><code>problem-statement.md</code></a>). See the <strong>Proposed solution</strong> and <strong>At scale: per-tool tags</strong> tabs above for how list tags and per-tool tags address these requirements (see also <a href="versioning-scope-decision.md"><code>versioning-scope-decision.md</code></a>).
      </p>
    </footer>
  </section>

  <!-- TAB 2: WHERE MISMATCHES HAPPEN -->
  <section class="tabpanel" id="panel-topologies" role="tabpanel" aria-labelledby="tab-btn-topologies" hidden>
    <p class="topo-intro">
      <strong>Discovery and execution can reach different versions of the same service.</strong> Routine deployments, load balancers, and multi-service gateways create windows where the node handling <code>tools/call</code> runs a different definition from the one that answered <code>tools/list</code>.
    </p>

    <div id="topology-rows"></div>

    <div class="topo-closing">
      <p>
        <strong>Takeaway:</strong> Phased expand-and-contract schemas help with argument shape during rollouts, but cannot expose silent unit drift or calls prepared from stale startup caches. A definition reference could expose that the call was prepared before the confirmation UI was added. It would not prove that the client displayed the dialog. Because MCP is a transport-agnostic RPC protocol (including <code>stdio</code> without HTTP headers), traditional HTTP mechanisms like <code>ETag</code> and <code>If-Match</code> are not a direct fit: they describe a single HTTP resource representation rather than the tool or catalog definitions an RPC call depends on.
      </p>
    </div>
  </section>

  <!-- TAB 3: PROPOSED SOLUTION (LIST TAGS & COMPATIBILITY) -->
  <section class="tabpanel" id="panel-solution" role="tabpanel" aria-labelledby="tab-btn-solution" hidden>
    <div class="sol-lead">
      <p>
        Add an opaque <code>tag</code> to cacheable list responses (such as <code>tools/list</code>) alongside <code>ttlMs</code> and <code>cacheScope</code>. When a client prepares a call, it keeps that tag and echoes it on <code>tools/call</code> — even if its local cache refreshes before the call is sent.
      </p>
      <p>
        Backwards compatibility comes from three server behaviors: reject before running, accept and signal stale, or ignore.
      </p>
    </div>

    <div class="sol-block">
      <div class="sol-block-head">
        <h2>Tag the list, echo it on the call</h2>
        <div class="segmented" role="radiogroup" aria-label="Server response mode">
          <button type="button" role="radio" aria-checked="true" data-mode="reject">Reject before running</button>
          <button type="button" role="radio" aria-checked="false" data-mode="accept">Accept + signal stale</button>
          <button type="button" role="radio" aria-checked="false" data-mode="ignore">Ignore (legacy compat)</button>
        </div>
      </div>
      <p class="sol-intro" id="base-intro"></p>
      <div class="sol-diagram-wrap" id="base-svg-wrap"></div>

      <div class="outcomes-grid" aria-label="Server response semantics">
        <div class="outcome-col">
          <h3><span class="dot dot-warn"></span>Reject before running</h3>
          <p>When the server cannot safely honor the older definition, it rejects before side effects and echoes the client's stale tag (<code>L1</code>). The client refreshes, rebuilds, and decides whether to retry.</p>
          <p class="outcome-meta">error -32987 (illustrative) · data.staleTags</p>
        </div>
        <div class="outcome-col">
          <h3><span class="dot dot-ok"></span>Accept + signal stale</h3>
          <p>When the server can still honor the call (compatible edit, shim, or unchanged tool), it runs once and echoes stale <code>L1</code> in result metadata so the client refreshes without repeating the call.</p>
          <p class="outcome-meta">result._meta.staleTags · do not replay</p>
        </div>
        <div class="outcome-col">
          <h3><span class="dot dot-mute"></span>Ignore (backwards compat)</h3>
          <p>Older servers ignore unknown <code>_meta</code> keys, and servers may accept untagged calls from older clients (with no drift check). Whether servers must enforce supplied tags or may require them remains open.</p>
          <p class="outcome-meta">gradual adoption · enforcement policy open</p>
        </div>
      </div>

      <p class="drift-footnote">
        <strong>Stateless subscription catch-up too:</strong> Sending known tags when opening <code>subscriptions/<wbr>listen</code> (at startup or after a rolling-deploy drain) also lets any stateless replica compare tags immediately and emit <code>list_changed</code> without session history &mdash; complementing call-time checks while an older stream is still draining.
      </p>

      <details class="wire-details">
        <summary>+ Show illustrative wire JSON excerpts</summary>
        <p class="drift-footnote" style="margin-top:8px"><strong>Attribution:</strong> <code>resultType: "complete"</code>, <code>ttlMs</code>, and <code>cacheScope</code> are in the MCP caching draft. Highlighted fields (<code>tag</code>, <code>io.modelcontextprotocol/knownTags</code>, <code>staleTags</code>, <code>-32987</code>) are illustrative proposal spellings; exact wire layout remains open.</p>
        <div class="wire-grid" id="wire-excerpts-list"></div>
      </details>

      <div class="topo-closing">
        <p>
          <strong>Next question:</strong> A list tag works with zero per-tool overhead, but in a 50+ tool PTC catalog, editing two tools changes the whole list tag. Open <strong>At scale: per-tool tags</strong> to see how per-tool tags isolate call verification at scale.
        </p>
      </div>
    </div>
  </section>

  <!-- TAB 4: AT SCALE (52-TOOL PTC CATALOG BLAST RADIUS) -->
  <section class="tabpanel" id="panel-scale" role="tabpanel" aria-labelledby="tab-btn-scale" hidden>
    <div class="sol-lead">
      <p>
        With PTC (programmatic tool calling) or multi-service proxies, a single MCP server routinely exposes <strong>50+ tools</strong> across distinct capability groups.
      </p>
      <p>
        When one interrelated pair of tools changes, should a stateless server have to reject calls to the other 50 tools, or can it verify untouched tools independently? (Refreshing may still fetch the whole list &mdash; per-tool tags narrow call verification, not delta fetching.)
      </p>
    </div>

    <div class="sol-block">
      <div class="sol-block-head">
        <h2>Blast radius of a 2-tool edit in a 52-tool catalog</h2>
        <div class="segmented" role="radiogroup" aria-label="Tag granularity">
          <button type="button" role="radio" aria-checked="true" data-gran="list">List tag only (L1 → L2)</button>
          <button type="button" role="radio" aria-checked="false" data-gran="prim">List + per-tool tags</button>
        </div>
      </div>
      <p class="sol-intro" id="scale-intro"></p>

      <div class="catalog-stage">
        <div class="catalog-summary">
          <div class="blast-stat" id="blast-stat"></div>
          <div class="legend-inline">
            <span class="legend-item"><i class="swatch sw-bad"></i>Changed tools (2)</span>
            <span class="legend-item"><i class="swatch sw-warn"></i>Unknown without history</span>
            <span class="legend-item"><i class="swatch sw-ok"></i>Verified unchanged</span>
          </div>
        </div>
        <div class="groups-grid" id="groups-grid"></div>
      </div>

      <div class="tradeoff-grid">
        <div class="tradeoff-col">
          <h3>List tag only (box label)</h3>
          <p><strong>1 tag per list response</strong> (zero per-tool bytes on the wire). Changing 2 interrelated tools flips <code>L1 → L2</code> for all 52 tools.</p>
          <p>A stateless replica cannot tell which of the 52 tools changed; avoiding false rejections on the other 50 tools requires a server-side history or diff index for <code>L1</code>.</p>
        </div>
        <div class="tradeoff-col">
          <h3>List + per-tool tags</h3>
          <p><strong>+1 tag per listed tool</strong> (and the invoked tool's tag echoed on <code>tools/call</code>). Changing the 2 interrelated tools only changes those 2 tags.</p>
          <p>Any stateless replica with deterministic tags verifies the other 50 untouched tools directly (<code>tag = tag</code>) with no old catalog lookup, while <code>L1 ≠ L2</code> still signals a lazy refresh for additions or removals.</p>
        </div>
      </div>

      <details class="wire-details">
        <summary>+ Show illustrative per-tool wire JSON excerpts</summary>
        <p class="drift-footnote" style="margin-top:8px"><strong>Attribution:</strong> <code>resultType: "complete"</code>, <code>ttlMs</code>, and <code>cacheScope</code> are in the MCP caching draft. Highlighted fields (<code>tag</code>, <code>io.modelcontextprotocol/knownTags</code>, <code>io.modelcontextprotocol/primitiveTag</code>) are illustrative proposal spellings; exact wire layout remains open.</p>
        <div class="wire-grid" id="wire-excerpts-scale"></div>
      </details>

      <div class="topo-closing">
        <p>
          <strong>Groups, instructions &amp; compatible edits:</strong> Per-tool tags verify an unchanged tool definition without history, but do not verify whether <code>server/discover</code> or group instructions changed, and do not provide delta fetching. Group tags (if tools are discovered by group) version a whole group together rather than individual tools, and need per-group identity. Neither replaces server-side compatibility logic when a <em>changed</em> tool must keep honoring older callers (<a href="versioning-scope-decision.md"><code>versioning-scope-decision.md</code></a>).
        </p>
      </div>
    </div>
  </section>
</div>

<script>
(function () {
  var EXAMPLES = {
    minimal: {
      drift: {
        unit: {
          clientDescHtml: 'Read <code>v1</code> description (fresh within <code>ttlMs</code> or reused at startup): <code>combine(a, b)</code> returns <strong>a + b</strong>.',
          clientCode: 'Intent: 10 + 4 = 14',
          clientAmber: false,
          wireCode: 'combine(a: 10, b: 4)',
          wireDescHtml: '<code>inputSchema</code> checks two numbers <code>a</code> and <code>b</code>. Both satisfy validation; no field identifies <code>v1</code>.',
          serverAmber: false,
          serverVerdict: 'Silent behavior mismatch',
          serverDescHtml: '<code>v2</code> changed <code>combine</code> to return <strong>a &minus; b</strong> with the same schema. Validation passes; client expects <strong>14</strong> and receives <strong>6</strong>.'
        },
        metadata: {
          clientDescHtml: 'Cached <code>v1</code> definition had no <code>_meta.ui</code> confirmation dialog. Client prepares and sends the call directly.',
          clientCode: 'Prepared before confirmation UI existed',
          clientAmber: false,
          wireCode: 'combine(a: 10, b: 4)',
          wireDescHtml: '<code>inputSchema</code> did not change in <code>v2</code>. The request payload looks identical whether UI metadata was added or not.',
          serverAmber: false,
          serverVerdict: 'Prepared without v2 UI metadata',
          serverDescHtml: '<code>v2</code> added <code>_meta.ui</code> without changing <code>inputSchema</code>. The call runs without the client ever seeing <code>v2</code>.'
        },
        approval: {
          clientDescHtml: 'Builds <code>combine(10, 4)</code> expecting <strong>14</strong> (<code>a + b</code>) and pauses for approval. While waiting, a background refresh updates the cache to <code>v2</code> (<code>a &minus; b</code>).',
          clientCode: 'Cache is now v2 · Prepared call still v1',
          clientAmber: true,
          wireCode: 'combine(a: 10, b: 4)',
          wireDescHtml: 'User clicks <strong>Approve</strong>. The already-prepared call fires &mdash; refreshing the cache did not rebuild the call.',
          serverAmber: true,
          serverVerdict: 'Stale call fires despite fresh cache',
          serverDescHtml: 'Even though the client cache holds <code>v2</code>, the approved payload still reflects <code>v1</code> and returns <strong>6</strong> instead of <strong>14</strong>.'
        }
      },
      topo: {
        callMono: 'combine(a: 10, b: 4)',
        v1Short: 'v1: returns a + b',
        v2Short: 'v2: returns a − b',
        singleServerLine: 'Evaluates 10 − 4 and returns 6 (expected 14)',
        podALine: 'Advertises v1: combine (returns a + b)',
        podBLine: 'Executes v2: combine (returns a − b)',
        podBOutcome: 'Same inputs, different operation',
        rollingWhyHard: 'A refresh can hit A again. If the next call hits B, the inputs still validate while running the new behavior.',
        backendAHeader: 'Backend A (formatting)',
        backendAOwns: 'Owns: format_number (v1, unchanged)',
        backendBHeader: 'Backend B (arithmetic)',
        backendBOwns: 'Owns: combine → deployed v2 (a − b)'
      }
    },
    hf: {
      drift: {
        unit: {
          clientDescHtml: 'Read <code>v1</code> description (fresh within <code>ttlMs</code> or reused at startup): <code>timeout</code> is in <strong>minutes</strong>.',
          clientCode: 'Intent: 30-minute training job',
          clientAmber: false,
          wireCode: 'hf_job_run(timeout: 30)',
          wireDescHtml: '<code>inputSchema</code> checks <code>timeout: number</code>. <code>30</code> satisfies validation; no field identifies <code>v1</code>.',
          serverAmber: false,
          serverVerdict: 'Silent unit mismatch',
          serverDescHtml: '<code>v2</code> updated <code>timeout</code> to <strong>seconds</strong>. Validation passes; a <strong>30-minute</strong> job is killed after <strong>30 seconds</strong>.'
        },
        metadata: {
          clientDescHtml: 'Cached <code>v1</code> definition had no <code>_meta.ui</code> spend-confirmation dialog. Client prepares and sends the call directly.',
          clientCode: 'Prepared before spend UI existed',
          clientAmber: false,
          wireCode: 'hf_job_run(flavor: "a100-large", script: "eval.py")',
          wireDescHtml: '<code>inputSchema</code> did not change in <code>v2</code>. The request payload looks identical whether a dialog was defined or not.',
          serverAmber: false,
          serverVerdict: 'Prepared without v2 UI metadata',
          serverDescHtml: '<code>v2</code> added a <code>_meta.ui</code> spend-confirmation dialog without changing <code>inputSchema</code>. Paid GPU job runs without seeing <code>v2</code>.'
        },
        approval: {
          clientDescHtml: 'Builds <code>timeout: 30</code> (<strong>30 min</strong>) and pauses for approval. While waiting, a background refresh updates the local cache to <code>v2</code> (<strong>seconds</strong>).',
          clientCode: 'Cache is now v2 · Prepared call still v1',
          clientAmber: true,
          wireCode: 'hf_job_run(timeout: 30)',
          wireDescHtml: 'User clicks <strong>Approve</strong>. The already-prepared call fires with <code>30</code> &mdash; refreshing the cache did not rebuild the call.',
          serverAmber: true,
          serverVerdict: 'Stale call fires despite fresh cache',
          serverDescHtml: 'Even though the client cache holds <code>v2</code>, the approved payload still reflects <code>v1</code> and runs with a <strong>30-second</strong> timeout.'
        }
      },
      topo: {
        callMono: 'hf_job_run(timeout: 30)',
        v1Short: 'v1: timeout in minutes',
        v2Short: 'v2: timeout in seconds',
        singleServerLine: 'Interprets timeout: 30 as 30 seconds',
        podALine: 'Advertises v1: hf_job_run (minutes)',
        podBLine: 'Executes v2: hf_job_run (seconds)',
        podBOutcome: 'Same number, different timeout',
        rollingWhyHard: 'A refresh can hit A again. If the next call hits B, the number still validates with the wrong unit.',
        backendAHeader: 'Backend A (catalog)',
        backendAOwns: 'Owns: hf_models_search (v1, unchanged)',
        backendBHeader: 'Backend B (compute / billing)',
        backendBOwns: 'Owns: hf_job_run → deployed v2 (seconds + UI)'
      }
    },
    db: {
      drift: {
        unit: {
          clientDescHtml: 'Read <code>v1</code> schema (fresh within <code>ttlMs</code> or reused at startup): <code>create_instance</code> lists supported Postgres versions up to <strong>POSTGRES_18</strong>.',
          clientCode: 'Intent: latest Postgres (saw up to 18)',
          clientAmber: false,
          wireCode: 'create_instance("POSTGRES_18")',
          wireDescHtml: '<code>"POSTGRES_18"</code> is still a valid enum value in <code>v2</code>. Validation passes; no field identifies <code>v1</code>.',
          serverAmber: false,
          serverVerdict: 'Silent stale choice',
          serverDescHtml: '<code>v2</code> rolled out <strong>POSTGRES_19</strong> in the schema enum. Validation passes; the server provisions <strong>Postgres 18</strong> and cannot tell the model never saw <strong>Postgres 19</strong>.'
        },
        metadata: {
          clientDescHtml: 'Cached <code>v1</code> definition had no <code>_meta.ui</code> provisioning confirmation dialog. Client prepares and sends the call directly.',
          clientCode: 'Prepared before confirmation UI existed',
          clientAmber: false,
          wireCode: 'create_instance("POSTGRES_18")',
          wireDescHtml: '<code>inputSchema</code> did not change in <code>v2</code>. The request payload looks identical whether a dialog was defined or not.',
          serverAmber: false,
          serverVerdict: 'Prepared without v2 UI metadata',
          serverDescHtml: '<code>v2</code> added a <code>_meta.ui</code> provisioning confirmation dialog without changing <code>inputSchema</code>. Instance provisioning runs without seeing <code>v2</code>.'
        },
        approval: {
          clientDescHtml: 'Builds <code>database_version: "POSTGRES_18"</code> ("latest Postgres") and pauses for approval. While waiting, a background refresh updates the cache to <code>v2</code> (adds <strong>POSTGRES_19</strong>).',
          clientCode: 'Cache is now v2 · Prepared call still v1',
          clientAmber: true,
          wireCode: 'create_instance("POSTGRES_18")',
          wireDescHtml: 'User clicks <strong>Approve</strong>. The already-prepared call fires with <code>"POSTGRES_18"</code> &mdash; refreshing the cache did not rebuild the call.',
          serverAmber: true,
          serverVerdict: 'Stale call fires despite fresh cache',
          serverDescHtml: 'Even though the client cache holds <code>v2</code> with <strong>POSTGRES_19</strong>, the approved payload still reflects <code>v1</code> and provisions <strong>Postgres 18</strong>.'
        }
      },
      topo: {
        callMono: 'create_instance("POSTGRES_18")',
        v1Short: 'v1: Postgres up to POSTGRES_18',
        v2Short: 'v2: adds POSTGRES_19',
        singleServerLine: 'Provisions Postgres 18 (valid enum in v2)',
        podALine: 'Advertises v1: create_instance (≤ PG 18)',
        podBLine: 'Executes v2: create_instance (≤ PG 19)',
        podBOutcome: 'Valid enum, stale "latest" choice',
        rollingWhyHard: 'A refresh can hit A again. If the next call hits B, "POSTGRES_18" still validates even though B supports POSTGRES_19.',
        backendAHeader: 'Backend A (inventory)',
        backendAOwns: 'Owns: list_instances (v1, unchanged)',
        backendBHeader: 'Backend B (provisioning)',
        backendBOwns: 'Owns: create_instance → deployed v2 (+ PG 19)'
      }
    }
  };


  var SOL_DATA = {
    minimal: {
      changedTool: 'combine',
      changedCall: 'combine(10, 4)',
      changedEdit: 'v1 (a + b) → v2 (a − b)',
      changedSafeNote: 'Blocks 10 − 4 = 6 (expected 14)',
      unchangedTool: 'format_number',
      t1: 'F1', t2old: 'C1', t2new: 'C2',
      scaleIntro: 'Two interrelated tools in <strong>Core arithmetic</strong> (<code>combine</code> and <code>combine_batch</code>) changed from <code>a + b</code> to <code>a − b</code>. The other 50 tools across 5 groups are untouched.',
      groups: [
        { name: 'Core arithmetic', count: 6, changed: ['combine', 'combine_batch'], sample: ['add', 'sub', 'mul', 'div'] },
        { name: 'Formatting', count: 9, changed: [], sample: ['format_number', 'round', 'pad'] },
        { name: 'Strings & parsing', count: 10, changed: [], sample: ['split', 'trim', 'match'] },
        { name: 'Dates & time', count: 9, changed: [], sample: ['now', 'diff', 'tz'] },
        { name: 'Collections', count: 9, changed: [], sample: ['sort', 'filter', 'map'] },
        { name: 'Encoding', count: 9, changed: [], sample: ['b64', 'hash', 'json'] }
      ]
    },
    hf: {
      changedTool: 'hf_job_run',
      changedCall: 'hf_job_run(timeout: 30)',
      changedEdit: 'v1 (minutes) → v2 (seconds)',
      changedSafeNote: 'Blocks 30s timeout (meant 30m)',
      unchangedTool: 'hf_models_search',
      t1: 'M1', t2old: 'J1', t2new: 'J2',
      scaleIntro: 'In a 52-tool Hugging Face PTC catalog, two interrelated tools in <strong>Jobs &amp; Compute</strong> (<code>hf_job_run</code> and <code>hf_job_schedule</code>) switch <code>timeout</code> from minutes to seconds. The other 50 tools across Discovery, Repos, Sandboxes, Datasets, and Spaces are untouched.',
      groups: [
        { name: 'Jobs & Compute', count: 7, changed: ['hf_job_run', 'hf_job_schedule'], sample: ['hf_jobs_list', 'hf_job_logs', 'hf_job_get'] },
        { name: 'Discovery & Search', count: 10, changed: [], sample: ['hf_models_search', 'hf_trending', 'hf_hub_lookup'] },
        { name: 'Repos & Files', count: 9, changed: [], sample: ['hf_repo_info', 'hf_repo_write', 'hf_repo_read'] },
        { name: 'Sandboxes', count: 7, changed: [], sample: ['hf_sandbox_create', 'hf_sandbox_exec', 'hf_sandbox_kill'] },
        { name: 'Datasets & Papers', count: 8, changed: [], sample: ['hf_dataset_rows', 'hf_papers_search', 'hf_daily_papers'] },
        { name: 'People & Spaces', count: 11, changed: [], sample: ['hf_spaces_list', 'hf_profile_get', 'hf_space_invoke'] }
      ]
    },
    db: {
      changedTool: 'create_instance',
      changedCall: 'create_instance("POSTGRES_18")',
      changedEdit: 'v1 (≤ PG 18) → v2 (+ PG 19)',
      changedSafeNote: 'Blocks PG 18 before model sees PG 19',
      unchangedTool: 'list_instances',
      t1: 'I1', t2old: 'C1', t2new: 'C2',
      scaleIntro: 'In a 52-tool Database Toolbox catalog, two interrelated tools in <strong>Provisioning</strong> (<code>create_instance</code> and <code>clone_instance</code>) add <code>POSTGRES_19</code> to their version enum. The other 50 tools across Inventory, Queries, Schema, Backups, and Monitoring are untouched.',
      groups: [
        { name: 'Provisioning', count: 7, changed: ['create_instance', 'clone_instance'], sample: ['resize_instance', 'restart_instance', 'promote_replica'] },
        { name: 'Inventory & Users', count: 9, changed: [], sample: ['list_instances', 'get_instance', 'list_users'] },
        { name: 'Queries & Plans', count: 10, changed: [], sample: ['execute_sql', 'explain_query', 'list_active_tx'] },
        { name: 'Schema & Tables', count: 9, changed: [], sample: ['list_tables', 'describe_table', 'list_indexes'] },
        { name: 'Backups & Restore', count: 8, changed: [], sample: ['list_backups', 'create_backup', 'pitr_status'] },
        { name: 'Monitoring & Logs', count: 9, changed: [], sample: ['query_insights', 'slow_logs', 'cpu_metrics'] }
      ]
    }
  };

  var state = {
    example: 'hf',
    tab: 'problem',
    drift: 'unit',
    mode: 'reject',
    gran: 'list'
  };

  /* Initialize from URL query parameters (?tab=problem|topologies&ex=hf|db) */
  try {
    var params = new URLSearchParams(window.location.search);
    var qTab = params.get('tab');
    var qEx = params.get('ex');
    var qDrift = params.get('drift');
    if (qTab === 'problem' || qTab === 'topologies' || qTab === 'solution' || qTab === 'scale') {
      state.tab = qTab;
    }
    var qMode = params.get('mode');
    if (qMode === 'reject' || qMode === 'accept' || qMode === 'ignore') state.mode = qMode;
    var qGran = params.get('gran');
    if (qGran === 'list' || qGran === 'prim') state.gran = qGran;
    if (qEx === 'minimal' || qEx === 'hf' || qEx === 'db') {
      state.example = qEx;
    }
    if (qDrift === 'unit' || qDrift === 'metadata' || qDrift === 'approval') {
      state.drift = qDrift;
    }
  } catch (_) {}

  function syncUrlParams() {
    try {
      var url = new URL(window.location.href);
      url.searchParams.set('tab', state.tab);
      url.searchParams.set('ex', state.example);
      window.history.replaceState(null, '', url.toString());
    } catch (_) {}
  }

  function esc(str) {
    return String(str)
      .replace(/&/g, '&amp;')
      .replace(/</g, '&lt;')
      .replace(/>/g, '&gt;')
      .replace(/"/g, '&quot;');
  }

  function renderSingleServerSvg(t) {
    return (
      '<svg viewBox="0 0 1024 192" role="img" aria-label="In-place deploy diagram: Client holds cached v1 list while single server updates in place to v2">' +
        '<defs>' +
          '<marker id="arr-list-s1" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#1D4ED8"/>' +
          '</marker>' +
          '<marker id="arr-call-s1" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#B91C1C"/>' +
          '</marker>' +
        '</defs>' +

        /* Client [12..332] */
        '<rect x="12" y="22" width="320" height="148" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="12" y1="58" x2="332" y2="58" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="26" y="45" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Client <tspan font-weight="400" fill="#475569">(TTL or startup cache)</tspan></text>' +
        '<text x="26" y="84" font-family="Inter, sans-serif" font-size="13" fill="#334155">Holds ' + esc(t.v1Short) + '</text>' +
        '<text x="26" y="111" font-family="JetBrains Mono, monospace" font-size="13" font-weight="500" fill="#0F172A">' + esc(t.callMono) + '</text>' +
        '<text x="26" y="138" font-family="Inter, sans-serif" font-size="13" fill="#475569">Within ttlMs, or startup cache reused</text>' +

        /* Lanes between Client (332) and Server (648) */
        '<path d="M 648 62 L 340 62" fill="none" stroke="#1D4ED8" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arr-list-s1)"/>' +
        '<text x="490" y="49" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#1D4ED8">① List response: v1</text>' +

        '<rect x="392" y="83" width="196" height="26" rx="13" fill="#FFFBEB" stroke="#FCD34D" stroke-width="1"/>' +
        '<text x="490" y="100" text-anchor="middle" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="#B45309">Deploy replaces v1 → v2</text>' +

        '<path d="M 332 134 L 640 134" fill="none" stroke="#B91C1C" stroke-width="1.75" marker-end="url(#arr-call-s1)"/>' +
        '<text x="490" y="154" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#B91C1C">② Later tools/call</text>' +

        /* Single Server [648..1012] */
        '<rect x="648" y="22" width="364" height="148" rx="5" fill="#FFFFFF" stroke="#FCA5A5" stroke-width="1.2"/>' +
        '<line x1="648" y1="58" x2="1012" y2="58" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="662" y="45" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Single server <tspan font-weight="400" fill="#475569">(updated in place)</tspan></text>' +
        '<text x="662" y="84" font-family="Inter, sans-serif" font-size="13" fill="#334155">Now serves ' + esc(t.v2Short) + '</text>' +
        '<text x="662" y="111" font-family="Inter, sans-serif" font-size="13" fill="#334155">' + esc(t.singleServerLine) + '</text>' +
        '<text x="662" y="138" font-family="Inter, sans-serif" font-size="13" font-weight="500" fill="#B91C1C">Arguments pass v2 validation</text>' +
      '</svg>'
    );
  }

  function renderRollingLbSvg(t) {
    return (
      '<svg viewBox="0 0 1024 230" role="img" aria-label="Rolling deploy diagram: Client lists v1 from Pod A through a load balancer, then call hits Pod B running v2">' +
        '<defs>' +
          '<marker id="arr-list-s2" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#1D4ED8"/>' +
          '</marker>' +
          '<marker id="arr-call-s2" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#B91C1C"/>' +
          '</marker>' +
        '</defs>' +

        /* Client [12..288] */
        '<rect x="12" y="44" width="276" height="140" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="12" y1="80" x2="288" y2="80" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="26" y="67" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Client</text>' +
        '<text x="26" y="105" font-family="Inter, sans-serif" font-size="13" fill="#334155">Discovered v1 from Pod A</text>' +
        '<text x="26" y="131" font-family="JetBrains Mono, monospace" font-size="13" font-weight="500" fill="#0F172A">' + esc(t.callMono) + '</text>' +
        '<text x="26" y="157" font-family="Inter, sans-serif" font-size="13" fill="#475569">Refresh may hit Pod A (v1) again</text>' +

        /* Load balancer [424..544] */
        '<rect x="424" y="72" width="120" height="84" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<text x="484" y="108" text-anchor="middle" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Load balancer</text>' +
        '<text x="484" y="130" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" fill="#475569">Stateless hop</text>' +

        /* Zero-crossing lanes: top = Pod A -> LB -> Client (list v1); bottom = Client -> LB -> Pod B (call) */
        '<path d="M 624 58 C 580 58, 572 96, 544 96" fill="none" stroke="#1D4ED8" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arr-list-s2)"/>' +
        '<path d="M 424 96 L 296 96" fill="none" stroke="#1D4ED8" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arr-list-s2)"/>' +
        '<text x="356" y="84" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#1D4ED8">① v1 list</text>' +

        '<path d="M 288 130 L 418 130" fill="none" stroke="#B91C1C" stroke-width="1.75" marker-end="url(#arr-call-s2)"/>' +
        '<path d="M 544 130 C 576 130, 584 169, 618 169" fill="none" stroke="#B91C1C" stroke-width="1.75" marker-end="url(#arr-call-s2)"/>' +
        '<text x="356" y="150" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#B91C1C">② tools/call</text>' +

        /* Pod A (v1) [624..1012] */
        '<rect x="624" y="12" width="388" height="94" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="624" y1="45" x2="1012" y2="45" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="638" y="34" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Pod A (v1) <tspan font-weight="400" fill="#475569">(older replica)</tspan></text>' +
        '<text x="638" y="68" font-family="Inter, sans-serif" font-size="13" fill="#334155">' + esc(t.podALine) + '</text>' +
        '<text x="638" y="91" font-family="Inter, sans-serif" font-size="13" fill="#475569">Still returns v1 if client refreshes</text>' +

        /* Pod B (v2) [624..1012] */
        '<rect x="624" y="122" width="388" height="96" rx="5" fill="#FFFFFF" stroke="#FCA5A5" stroke-width="1.2"/>' +
        '<line x1="624" y1="155" x2="1012" y2="155" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="638" y="144" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Pod B (v2) <tspan font-weight="400" fill="#475569">(updated replica)</tspan></text>' +
        '<text x="638" y="178" font-family="Inter, sans-serif" font-size="13" fill="#334155">' + esc(t.podBLine) + '</text>' +
        '<text x="638" y="201" font-family="Inter, sans-serif" font-size="13" font-weight="500" fill="#B91C1C">' + esc(t.podBOutcome) + '</text>' +
      '</svg>'
    );
  }

  function renderGatewaySvg(t) {
    return (
      '<svg viewBox="0 0 1024 230" role="img" aria-label="Multi-backend gateway diagram: Gateway serves merged v1 list while Backend B independently deploys v2">' +
        '<defs>' +
          '<marker id="arr-list-s3" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#1D4ED8"/>' +
          '</marker>' +
          '<marker id="arr-call-s3" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto">' +
            '<path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#B91C1C"/>' +
          '</marker>' +
        '</defs>' +

        /* Client [12..276] */
        '<rect x="12" y="44" width="264" height="140" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="12" y1="80" x2="276" y2="80" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="26" y="67" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Client</text>' +
        '<text x="26" y="105" font-family="Inter, sans-serif" font-size="13" fill="#334155">Holds merged v1 catalog</text>' +
        '<text x="26" y="131" font-family="JetBrains Mono, monospace" font-size="13" font-weight="500" fill="#0F172A">' + esc(t.callMono) + '</text>' +
        '<text x="26" y="157" font-family="Inter, sans-serif" font-size="13" fill="#475569">Sees one unified MCP endpoint</text>' +

        /* Gateway [406..568] */
        '<rect x="406" y="56" width="162" height="114" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="406" y1="90" x2="568" y2="90" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="487" y="78" text-anchor="middle" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Proxy / gateway</text>' +
        '<text x="487" y="114" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" fill="#334155">Caches upstream lists</text>' +
        '<text x="487" y="138" text-anchor="middle" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="#B45309">Still advertises v1</text>' +

        /* Client <-> Gateway lanes */
        '<path d="M 406 96 L 284 96" fill="none" stroke="#1D4ED8" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#arr-list-s3)"/>' +
        '<text x="341" y="84" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#1D4ED8">① v1 list</text>' +

        '<path d="M 276 132 L 400 132" fill="none" stroke="#B91C1C" stroke-width="1.75" marker-end="url(#arr-call-s3)"/>' +
        '<text x="341" y="152" text-anchor="middle" font-family="Inter, sans-serif" font-size="13" font-weight="600" fill="#B91C1C">② tools/call</text>' +

        /* Gateway -> Backends */
        '<path d="M 568 86 C 598 86, 606 58, 634 58" fill="none" stroke="#94A3B8" stroke-width="1.4" stroke-dasharray="4 3"/>' +
        '<path d="M 568 136 C 598 136, 606 169, 628 169" fill="none" stroke="#B91C1C" stroke-width="1.75" marker-end="url(#arr-call-s3)"/>' +

        /* Backend A [634..1012] */
        '<rect x="634" y="12" width="378" height="94" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="634" y1="45" x2="1012" y2="45" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="648" y="34" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">' + esc(t.backendAHeader) + ' <tspan font-weight="400" fill="#475569">(v1)</tspan></text>' +
        '<text x="648" y="68" font-family="Inter, sans-serif" font-size="13" fill="#334155">' + esc(t.backendAOwns) + '</text>' +
        '<text x="648" y="91" font-family="Inter, sans-serif" font-size="13" fill="#475569">Independent release cadence</text>' +

        /* Backend B [634..1012] */
        '<rect x="634" y="122" width="378" height="96" rx="5" fill="#FFFFFF" stroke="#FCA5A5" stroke-width="1.2"/>' +
        '<line x1="634" y1="155" x2="1012" y2="155" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="648" y="144" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">' + esc(t.backendBHeader) + ' <tspan font-weight="400" fill="#475569">(v2)</tspan></text>' +
        '<text x="648" y="178" font-family="Inter, sans-serif" font-size="13" fill="#334155">' + esc(t.backendBOwns) + '</text>' +
        '<text x="648" y="201" font-family="Inter, sans-serif" font-size="13" font-weight="500" fill="#B91C1C">Gateway advertises v1; client uses v1</text>' +
      '</svg>'
    );
  }


  function renderBaseSvg(ex, mode) {
    var isReject = mode === 'reject';
    var isAccept = mode === 'accept';
    var replyColor = isReject ? '#B91C1C' : isAccept ? '#15803D' : '#475569';
    var replyBg = isReject ? '#FEF2F2' : isAccept ? '#F0FDF4' : '#F8FAFC';
    var replyBd = isReject ? '#FCA5A5' : isAccept ? '#86EFAC' : '#CBD5E1';
    var replyArrowLabel = isReject
      ? '③ error -32987 · staleTags: { "tools/list": "L1" }'
      : isAccept
        ? '③ result + staleTags: { "tools/list": "L1" }'
        : '③ result (unknown _meta ignored)';
    var serverLine1 = isReject
      ? 'Sees L1 ≠ L2 · cannot honor v1 safely'
      : isAccept
        ? 'Sees L1 ≠ L2 · honors call (shim or compatible)'
        : 'Ignores unknown _meta (legacy server)';
    var serverLine2 = isReject
      ? ex.changedSafeNote
      : isAccept
        ? 'Runs once; flags L1 stale for next turn'
        : 'Runs as today — no drift protection';
    var serverFooter = (isReject || isAccept)
      ? 'Echoes client\'s stale L1 (illustrative)'
      : 'Does not check or echo tags';
    var clientFooter = isReject
      ? 'Did not run → refreshes L2, rebuilds call'
      : isAccept
        ? 'Already ran → refreshes L2, does not replay'
        : 'Legacy behavior preserved';

    return (
      '<svg viewBox="0 0 960 206" role="img" aria-label="List tag flow showing discovery, echoed knownTags, and server response">' +
        '<defs>' +
          '<marker id="a-blue" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#1D4ED8"/></marker>' +
          '<marker id="a-ink" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="#0F172A"/></marker>' +
          '<marker id="a-rep" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="6" markerHeight="6" orient="auto"><path d="M 0 1.5 L 8.5 5 L 0 8.5 z" fill="' + replyColor + '"/></marker>' +
        '</defs>' +
        '<rect x="10" y="16" width="286" height="174" rx="5" fill="#FFFFFF" stroke="#CBD5E1" stroke-width="1.2"/>' +
        '<line x1="10" y1="50" x2="296" y2="50" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="24" y="38" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Client <tspan font-weight="400" fill="#475569">(cached list L1)</tspan></text>' +
        '<text x="24" y="76" font-family="Inter, sans-serif" font-size="12.5" fill="#334155">Prepared call from L1:</text>' +
        '<text x="24" y="99" font-family="JetBrains Mono, monospace" font-size="12.5" font-weight="500" fill="#0F172A">' + esc(ex.changedCall) + '</text>' +
        '<text x="24" y="124" font-family="Inter, sans-serif" font-size="12.5" fill="#475569">Keeps L1 attached to this call</text>' +
        '<rect x="22" y="144" width="262" height="32" rx="4" fill="' + replyBg + '" stroke="' + replyBd + '" stroke-width="1"/>' +
        '<text x="32" y="164" font-family="Inter, sans-serif" font-size="12" font-weight="500" fill="' + replyColor + '">' + esc(clientFooter) + '</text>' +
        '<path d="M 654 48 L 304 48" fill="none" stroke="#1D4ED8" stroke-width="1.5" stroke-dasharray="5 3" marker-end="url(#a-blue)"/>' +
        '<text x="475" y="36" text-anchor="middle" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="#1D4ED8">① tools/list → tag: "L1", ttlMs: 300000</text>' +
        '<path d="M 296 104 L 646 104" fill="none" stroke="#0F172A" stroke-width="1.6" marker-end="url(#a-ink)"/>' +
        '<text x="475" y="92" text-anchor="middle" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="#0F172A">② tools/call + knownTags: { "tools/list": "L1" }</text>' +
        '<path d="M 654 158 L 304 158" fill="none" stroke="' + replyColor + '" stroke-width="1.75" marker-end="url(#a-rep)"/>' +
        '<text x="475" y="146" text-anchor="middle" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="' + replyColor + '">' + esc(replyArrowLabel) + '</text>' +
        '<rect x="654" y="16" width="296" height="174" rx="5" fill="#FFFFFF" stroke="' + replyBd + '" stroke-width="1.2"/>' +
        '<line x1="654" y1="50" x2="950" y2="50" stroke="#E2E8F0" stroke-width="1"/>' +
        '<text x="668" y="38" font-family="Inter, sans-serif" font-size="13.5" font-weight="600" fill="#0F172A">Server <tspan font-weight="400" fill="#475569">(now list L2)</tspan></text>' +
        '<text x="668" y="76" font-family="Inter, sans-serif" font-size="12.5" fill="#334155">Updated: ' + esc(ex.changedEdit) + '</text>' +
        '<text x="668" y="102" font-family="Inter, sans-serif" font-size="12.5" font-weight="600" fill="' + replyColor + '">' + esc(serverLine1) + '</text>' +
        '<text x="668" y="128" font-family="Inter, sans-serif" font-size="12" fill="#475569">' + esc(serverLine2) + '</text>' +
        '<text x="668" y="164" font-family="JetBrains Mono, monospace" font-size="11.5" fill="#475569">' + esc(serverFooter) + '</text>' +
      '</svg>'
    );
  }

  function renderCatalogGrid(ex, gran) {
    var isPrim = gran === 'prim';
    var statEl = document.getElementById('blast-stat');
    if (isPrim) {
      statEl.className = 'blast-stat is-ok';
      statEl.textContent = '2 of 52 tools invalidated · 50 untouched tools verified without history';
    } else {
      statEl.className = 'blast-stat is-warn';
      statEl.textContent = 'All 52 tools fall under stale L1 ≠ L2 · stateless server cannot tell which 2 changed';
    }
    document.getElementById('groups-grid').innerHTML = ex.groups.map(function (g) {
      var hasChange = g.changed.length > 0;
      var grpClass = 'tool-group' + (hasChange ? ' has-change' : (!isPrim ? ' all-stale' : ''));
      var tiles = [];
      g.changed.forEach(function (name) {
        tiles.push('<span class="tile t-bad t-named" title="Changed in v2">' + esc(name) + '</span>');
      });
      var untouchedClass = isPrim ? 't-ok' : 't-warn';
      var shownSample = g.sample.slice(0, hasChange ? 1 : 2);
      shownSample.forEach(function (name) {
        tiles.push('<span class="tile ' + untouchedClass + ' t-named" title="Unchanged in v2">' + esc(name) + '</span>');
      });
      var rest = g.count - g.changed.length - shownSample.length;
      for (var i = 0; i < rest; i++) {
        tiles.push('<span class="tile ' + untouchedClass + '" title="Unchanged tool">' + (isPrim ? '✓' : '?') + '</span>');
      }
      var statusLabel = hasChange
        ? (g.changed.length + ' changed / ' + g.count)
        : (isPrim ? (g.count + ' verified') : (g.count + ' stale (L1)'));
      return (
        '<div class="' + grpClass + '">' +
          '<div class="group-head">' +
            '<span class="group-name">' + esc(g.name) + '</span>' +
            '<span class="group-count">' + esc(statusLabel) + '</span>' +
          '</div>' +
          '<div class="tile-row">' + tiles.join('') + '</div>' +
        '</div>'
      );
    }).join('');
  }

  function renderWireList(ex, mode) {
    var callJson =
      '{\n  "method": "tools/call",\n  "params": {\n    "name": "' + esc(ex.changedTool) + '",\n    "arguments": { ... },\n    "_meta": {\n      <span class="hl">"io.modelcontextprotocol/knownTags": { "tools/list": "L1" }</span>\n    }\n  }\n}';
    var respTitle, respJson;
    if (mode === 'reject') {
      respTitle = 'Server response: Reject before running';
      respJson =
        '{\n  "error": {\n    <span class="hl">"code": -32987</span>, /* illustrative */\n    "message": "Definitions changed; refresh before retrying.",\n    "data": {\n      <span class="hl">"staleTags": { "tools/list": "L1" }</span>\n    }\n  }\n}';
    } else if (mode === 'accept') {
      respTitle = 'Server response: Accept + signal stale';
      respJson =
        '{\n  "result": {\n    "resultType": "complete",\n    "content": [ { "type": "text", "text": "Done." } ],\n    "isError": false,\n    "_meta": {\n      <span class="hl">"io.modelcontextprotocol/staleTags": { "tools/list": "L1" }</span>\n    }\n  }\n}';
    } else {
      respTitle = 'Server response: Ignore (legacy compat)';
      respJson =
        '{\n  "result": {\n    "resultType": "complete",\n    "content": [ { "type": "text", "text": "Done." } ],\n    "isError": false\n  } /* unknown _meta.knownTags ignored */\n}';
    }
    return (
      '<div class="wire-pane"><h4>tools/call request (excerpt)</h4><pre>' + callJson + '</pre></div>' +
      '<div class="wire-pane"><h4>' + respTitle + '</h4><pre>' + respJson + '</pre></div>'
    );
  }

  function renderWireScale(ex, includePrim) {
    var listTitle = includePrim ? 'tools/list response (list + per-tool tags)' : 'tools/list response (list tag only)';
    var callTitle = includePrim ? 'tools/call request (echoes list + tool tag)' : 'tools/call request (echoes list tag only)';
    var listJson = includePrim
      ? '{\n  "resultType": "complete",\n  "ttlMs": 300000, "cacheScope": "private",\n  <span class="hl">"tag": "L1"</span>,\n  "tools": [\n    { "name": "' + esc(ex.unchangedTool) + '", <span class="hl">"tag": "' + esc(ex.t1) + '"</span>, ... },\n    { "name": "' + esc(ex.changedTool) + '", <span class="hl">"tag": "' + esc(ex.t2old) + '"</span>, ... }\n  ]\n}'
      : '{\n  "resultType": "complete",\n  "ttlMs": 300000, "cacheScope": "private",\n  <span class="hl">"tag": "L1"</span>,\n  "tools": [\n    { "name": "' + esc(ex.unchangedTool) + '", ... },\n    { "name": "' + esc(ex.changedTool) + '", ... } /* no per-tool tags */\n  ]\n}';
    var callJson = includePrim
      ? '{\n  "method": "tools/call",\n  "params": {\n    "name": "' + esc(ex.unchangedTool) + '",\n    "arguments": { ... },\n    "_meta": {\n      <span class="hl">"io.modelcontextprotocol/knownTags": { "tools/list": "L1" }</span>,\n      <span class="hl">"io.modelcontextprotocol/primitiveTag": "' + esc(ex.t1) + '"</span>\n    }\n  }\n}'
      : '{\n  "method": "tools/call",\n  "params": {\n    "name": "' + esc(ex.unchangedTool) + '",\n    "arguments": { ... },\n    "_meta": {\n      <span class="hl">"io.modelcontextprotocol/knownTags": { "tools/list": "L1" }</span>\n    }\n  }\n}';
    return (
      '<div class="wire-pane"><h4>' + listTitle + '</h4><pre>' + listJson + '</pre></div>' +
      '<div class="wire-pane"><h4>' + callTitle + '</h4><pre>' + callJson + '</pre></div>'
    );
  }

  function render() {
    var ex = EXAMPLES[state.example];

    /* Sync controls */
    document.querySelectorAll('[data-example]').forEach(function (btn) {
      btn.setAttribute('aria-checked', String(btn.getAttribute('data-example') === state.example));
    });

    document.querySelectorAll('[data-tab]').forEach(function (btn) {
      var active = btn.getAttribute('data-tab') === state.tab;
      btn.setAttribute('aria-selected', String(active));
      btn.tabIndex = active ? 0 : -1;
    });

    document.getElementById('panel-problem').hidden = state.tab !== 'problem';
    document.getElementById('panel-topologies').hidden = state.tab !== 'topologies';
    document.getElementById('panel-solution').hidden = state.tab !== 'solution';
    document.getElementById('panel-scale').hidden = state.tab !== 'scale';
    document.querySelectorAll('[data-mode]').forEach(function (btn) {
      btn.setAttribute('aria-checked', String(btn.getAttribute('data-mode') === state.mode));
    });
    document.querySelectorAll('[data-gran]').forEach(function (btn) {
      btn.setAttribute('aria-checked', String(btn.getAttribute('data-gran') === state.gran));
    });

    document.querySelectorAll('[data-drift]').forEach(function (btn) {
      btn.setAttribute('aria-checked', String(btn.getAttribute('data-drift') === state.drift));
    });

    /* Tab 1: Silent drift flow */
    var d = ex.drift[state.drift];
    document.getElementById('d-client-desc').innerHTML = d.clientDescHtml;
    var clientCodeEl = document.getElementById('d-client-code');
    clientCodeEl.textContent = d.clientCode;
    clientCodeEl.classList.toggle('is-amber', d.clientAmber);

    document.getElementById('d-wire-code').textContent = d.wireCode;
    document.getElementById('d-wire-desc').innerHTML = d.wireDescHtml;

    var serverBox = document.getElementById('d-server-box');
    serverBox.classList.toggle('is-amber-mismatch', d.serverAmber);
    document.getElementById('d-server-verdict').textContent = d.serverVerdict;
    document.getElementById('d-server-desc').innerHTML = d.serverDescHtml;

    /* Tab 2: 3 topology rows */
    var t = ex.topo;
    var topologies = [
      {
        heading: '1. In-place deploy or stale startup cache',
        svg: renderSingleServerSvg(t),
        howItHappens: 'The client reuses a fresh list within <code>ttlMs</code> or invokes optimistically from a persisted startup list without re-checking, while the single server replaces <code>v1</code> with <code>v2</code> in place.',
        whyHard: 'Because <code>v1</code> is overwritten in place and arguments still pass <code>v2</code> schema validation, neither side sees that the contract changed.'
      },
      {
        heading: '2. Rolling deploy behind a load balancer',
        svg: renderRollingLbSvg(t),
        howItHappens: '<code>tools/list</code> lands on Pod A (<code>v1</code>), and the subsequent <code>tools/call</code> routes to Pod B (<code>v2</code>) behind the same MCP endpoint &mdash; while any open <code>subscriptions/<wbr>listen</code> stream stays pinned to Pod A until connection drain.',
        whyHard: t.rollingWhyHard
      },
      {
        heading: '3. MCP proxy or multi-backend gateway',
        svg: renderGatewaySvg(t),
        howItHappens: 'A proxy or gateway caches and merges tools from independent upstream services. Backend B deploys <code>v2</code> while the proxy still advertises <code>v1</code> and the client uses <code>v1</code>. After a rollback, the proxy can still advertise <code>v2</code> while B runs <code>v1</code>.',
        whyHard: 'Even a client with zero caching still gets <code>v1</code> from the proxy until the proxy refreshes Backend B, and Backend B cannot tell from valid arguments alone which definition the caller used.'
      }
    ];

    var sol = SOL_DATA[state.example];
    document.getElementById('base-intro').innerHTML =
      'Client cached <code>L1</code>, server updated <code>' + esc(sol.changedTool) + '</code> (<code>' + esc(sol.changedEdit) + '</code>) to <code>L2</code>, and the client calls <code>' + esc(sol.changedCall) + '</code> echoing <code>L1</code>.';
    document.getElementById('base-svg-wrap').innerHTML = renderBaseSvg(sol, state.mode);
    document.getElementById('wire-excerpts-list').innerHTML = renderWireList(sol, state.mode);
    document.getElementById('scale-intro').innerHTML = sol.scaleIntro;
    renderCatalogGrid(sol, state.gran);
    document.getElementById('wire-excerpts-scale').innerHTML = renderWireScale(sol, state.gran === 'prim');

    document.getElementById('topology-rows').innerHTML = topologies.map(function (row) {
      return (
        '<article class="topo-row">' +
          '<h2>' + row.heading + '</h2>' +
          '<div class="diagram-wrap">' + row.svg + '</div>' +
          '<div class="row-captions">' +
            '<p class="caption-item"><strong>How it happens:</strong> ' + row.howItHappens + '</p>' +
            '<p class="caption-item"><strong>Why refreshing falls short:</strong> ' + row.whyHard + '</p>' +
          '</div>' +
        '</article>'
      );
    }).join('');
  }

  /* Event bindings */
  document.querySelectorAll('[data-example]').forEach(function (btn) {
    btn.addEventListener('click', function () {
      state.example = btn.getAttribute('data-example');
      syncUrlParams();
      render();
    });
  });

  document.querySelectorAll('[data-drift]').forEach(function (btn) {
    btn.addEventListener('click', function () {
      state.drift = btn.getAttribute('data-drift');
      render();
    });
  });

  var tabButtons = Array.prototype.slice.call(document.querySelectorAll('[data-tab]'));
  tabButtons.forEach(function (btn, idx) {
    btn.addEventListener('click', function () {
      state.tab = btn.getAttribute('data-tab');
      syncUrlParams();
      render();
    });
    btn.addEventListener('keydown', function (e) {
      if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
        e.preventDefault();
        var next = tabButtons[(idx + (e.key === 'ArrowRight' ? 1 : tabButtons.length - 1)) % tabButtons.length];
        state.tab = next.getAttribute('data-tab');
        syncUrlParams();
        render();
        next.focus();
      }
    });
  });

  document.querySelectorAll('[data-mode]').forEach(function (btn) {
    btn.addEventListener('click', function () { state.mode = btn.getAttribute('data-mode'); render(); });
  });
  document.querySelectorAll('[data-gran]').forEach(function (btn) {
    btn.addEventListener('click', function () { state.gran = btn.getAttribute('data-gran'); render(); });
  });

  render();
})();
</script>
</body>
</html>