@pmxt/mcp 2.30.2 → 2.30.5

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.
@@ -1,5 +1,5 @@
1
1
  // AUTO-GENERATED by mcp/scripts/generate-tools.js -- DO NOT EDIT
2
- // Generated from core/src/server/openapi.yaml (2026-04-11)
2
+ // Generated from core/src/server/openapi.yaml (2026-04-13)
3
3
  export const TOOLS = [
4
4
  {
5
5
  "name": "buildOrder",
@@ -94,6 +94,10 @@ export const TOOLS = [
94
94
  "type": "string"
95
95
  }
96
96
  }
97
+ },
98
+ "verbose": {
99
+ "type": "boolean",
100
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
97
101
  }
98
102
  },
99
103
  "required": [
@@ -171,6 +175,10 @@ export const TOOLS = [
171
175
  "type": "string"
172
176
  }
173
177
  }
178
+ },
179
+ "verbose": {
180
+ "type": "boolean",
181
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
174
182
  }
175
183
  },
176
184
  "required": [
@@ -284,6 +292,10 @@ export const TOOLS = [
284
292
  "type": "string"
285
293
  }
286
294
  }
295
+ },
296
+ "verbose": {
297
+ "type": "boolean",
298
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
287
299
  }
288
300
  },
289
301
  "required": [
@@ -379,6 +391,10 @@ export const TOOLS = [
379
391
  "type": "string"
380
392
  }
381
393
  }
394
+ },
395
+ "verbose": {
396
+ "type": "boolean",
397
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
382
398
  }
383
399
  },
384
400
  "required": [
@@ -394,7 +410,7 @@ export const TOOLS = [
394
410
  "name": "params",
395
411
  "kind": "object",
396
412
  "optional": true,
397
- "flatten": false
413
+ "flatten": true
398
414
  }
399
415
  ]
400
416
  },
@@ -450,6 +466,10 @@ export const TOOLS = [
450
466
  "type": "string"
451
467
  }
452
468
  }
469
+ },
470
+ "verbose": {
471
+ "type": "boolean",
472
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
453
473
  }
454
474
  },
455
475
  "required": [
@@ -540,6 +560,10 @@ export const TOOLS = [
540
560
  "type": "string"
541
561
  }
542
562
  }
563
+ },
564
+ "verbose": {
565
+ "type": "boolean",
566
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
543
567
  }
544
568
  },
545
569
  "required": [
@@ -555,7 +579,7 @@ export const TOOLS = [
555
579
  "name": "params",
556
580
  "kind": "object",
557
581
  "optional": true,
558
- "flatten": false
582
+ "flatten": true
559
583
  }
560
584
  ]
561
585
  },
@@ -629,6 +653,10 @@ export const TOOLS = [
629
653
  "slug": {
630
654
  "type": "string",
631
655
  "description": "Lookup by event slug"
656
+ },
657
+ "verbose": {
658
+ "type": "boolean",
659
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
632
660
  }
633
661
  },
634
662
  "required": [
@@ -644,7 +672,7 @@ export const TOOLS = [
644
672
  "name": "params",
645
673
  "kind": "object",
646
674
  "optional": true,
647
- "flatten": false
675
+ "flatten": true
648
676
  }
649
677
  ]
650
678
  },
@@ -718,6 +746,10 @@ export const TOOLS = [
718
746
  "slug": {
719
747
  "type": "string",
720
748
  "description": "Lookup by event slug"
749
+ },
750
+ "verbose": {
751
+ "type": "boolean",
752
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
721
753
  }
722
754
  },
723
755
  "required": [
@@ -733,7 +765,7 @@ export const TOOLS = [
733
765
  "name": "params",
734
766
  "kind": "object",
735
767
  "optional": true,
736
- "flatten": false
768
+ "flatten": true
737
769
  }
738
770
  ]
739
771
  },
@@ -823,6 +855,10 @@ export const TOOLS = [
823
855
  "similarityThreshold": {
824
856
  "type": "number",
825
857
  "description": "For semantic search (used by Limitless)"
858
+ },
859
+ "verbose": {
860
+ "type": "boolean",
861
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
826
862
  }
827
863
  },
828
864
  "required": [
@@ -838,7 +874,7 @@ export const TOOLS = [
838
874
  "name": "params",
839
875
  "kind": "object",
840
876
  "optional": true,
841
- "flatten": false
877
+ "flatten": true
842
878
  }
843
879
  ]
844
880
  },
@@ -928,6 +964,10 @@ export const TOOLS = [
928
964
  "similarityThreshold": {
929
965
  "type": "number",
930
966
  "description": "For semantic search (used by Limitless)"
967
+ },
968
+ "verbose": {
969
+ "type": "boolean",
970
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
931
971
  }
932
972
  },
933
973
  "required": [
@@ -943,7 +983,7 @@ export const TOOLS = [
943
983
  "name": "params",
944
984
  "kind": "object",
945
985
  "optional": true,
946
- "flatten": false
986
+ "flatten": true
947
987
  }
948
988
  ]
949
989
  },
@@ -975,6 +1015,10 @@ export const TOOLS = [
975
1015
  },
976
1016
  "cursor": {
977
1017
  "type": "string"
1018
+ },
1019
+ "verbose": {
1020
+ "type": "boolean",
1021
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
978
1022
  }
979
1023
  },
980
1024
  "required": [
@@ -990,7 +1034,7 @@ export const TOOLS = [
990
1034
  "name": "params",
991
1035
  "kind": "object",
992
1036
  "optional": true,
993
- "flatten": false
1037
+ "flatten": true
994
1038
  }
995
1039
  ]
996
1040
  },
@@ -1069,6 +1113,10 @@ export const TOOLS = [
1069
1113
  "type": "string"
1070
1114
  }
1071
1115
  }
1116
+ },
1117
+ "verbose": {
1118
+ "type": "boolean",
1119
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1072
1120
  }
1073
1121
  },
1074
1122
  "required": [
@@ -1084,7 +1132,7 @@ export const TOOLS = [
1084
1132
  "name": "params",
1085
1133
  "kind": "object",
1086
1134
  "optional": true,
1087
- "flatten": false
1135
+ "flatten": true
1088
1136
  }
1089
1137
  ]
1090
1138
  },
@@ -1139,6 +1187,10 @@ export const TOOLS = [
1139
1187
  "limit": {
1140
1188
  "type": "number",
1141
1189
  "description": "Maximum number of results to return"
1190
+ },
1191
+ "verbose": {
1192
+ "type": "boolean",
1193
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1142
1194
  }
1143
1195
  },
1144
1196
  "required": [
@@ -1217,6 +1269,10 @@ export const TOOLS = [
1217
1269
  "type": "string"
1218
1270
  }
1219
1271
  }
1272
+ },
1273
+ "verbose": {
1274
+ "type": "boolean",
1275
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1220
1276
  }
1221
1277
  },
1222
1278
  "required": [
@@ -1288,6 +1344,10 @@ export const TOOLS = [
1288
1344
  "type": "string"
1289
1345
  }
1290
1346
  }
1347
+ },
1348
+ "verbose": {
1349
+ "type": "boolean",
1350
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1291
1351
  }
1292
1352
  },
1293
1353
  "required": [
@@ -1333,6 +1393,10 @@ export const TOOLS = [
1333
1393
  },
1334
1394
  "id": {
1335
1395
  "type": "string"
1396
+ },
1397
+ "verbose": {
1398
+ "type": "boolean",
1399
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1336
1400
  }
1337
1401
  },
1338
1402
  "required": [
@@ -1405,6 +1469,10 @@ export const TOOLS = [
1405
1469
  "type": "string"
1406
1470
  }
1407
1471
  }
1472
+ },
1473
+ "verbose": {
1474
+ "type": "boolean",
1475
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1408
1476
  }
1409
1477
  },
1410
1478
  "required": [
@@ -1463,6 +1531,10 @@ export const TOOLS = [
1463
1531
  "limit": {
1464
1532
  "type": "number",
1465
1533
  "description": "Maximum number of results to return"
1534
+ },
1535
+ "verbose": {
1536
+ "type": "boolean",
1537
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1466
1538
  }
1467
1539
  },
1468
1540
  "required": [
@@ -1555,6 +1627,10 @@ export const TOOLS = [
1555
1627
  },
1556
1628
  "amount": {
1557
1629
  "type": "number"
1630
+ },
1631
+ "verbose": {
1632
+ "type": "boolean",
1633
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1558
1634
  }
1559
1635
  },
1560
1636
  "required": [
@@ -1656,6 +1732,10 @@ export const TOOLS = [
1656
1732
  },
1657
1733
  "amount": {
1658
1734
  "type": "number"
1735
+ },
1736
+ "verbose": {
1737
+ "type": "boolean",
1738
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1659
1739
  }
1660
1740
  },
1661
1741
  "required": [
@@ -1743,6 +1823,10 @@ export const TOOLS = [
1743
1823
  "type": "string"
1744
1824
  }
1745
1825
  }
1826
+ },
1827
+ "verbose": {
1828
+ "type": "boolean",
1829
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1746
1830
  }
1747
1831
  },
1748
1832
  "required": [
@@ -1867,6 +1951,10 @@ export const TOOLS = [
1867
1951
  "type": "string"
1868
1952
  }
1869
1953
  }
1954
+ },
1955
+ "verbose": {
1956
+ "type": "boolean",
1957
+ "description": "Return full uncompacted response. Default false returns a compact, agent-friendly summary."
1870
1958
  }
1871
1959
  },
1872
1960
  "required": [
package/dist/server.js CHANGED
@@ -9,6 +9,7 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
9
9
  import { TOOLS } from "./generated/tools.js";
10
10
  import { callPmxtApi } from "./client.js";
11
11
  import { reconstructArgs } from "./args.js";
12
+ import { compactResult } from "./shaper.js";
12
13
  const INSTRUCTIONS = `PMXT is a unified API for prediction markets (Polymarket, Kalshi, Limitless, and more). \
13
14
  Same methods, same response shape, regardless of venue.
14
15
 
@@ -74,7 +75,8 @@ export function createServer(config) {
74
75
  }
75
76
  // Separate credentials from the rest of the input
76
77
  const credentials = input.credentials;
77
- const { exchange: _ex, credentials: _cred, ...rest } = input;
78
+ const { exchange: _ex, credentials: _cred, verbose: _verbose, ...rest } = input;
79
+ const verbose = input.verbose === true;
78
80
  const args = reconstructArgs(rest, def.args);
79
81
  try {
80
82
  const result = await callPmxtApi(config, {
@@ -83,9 +85,10 @@ export function createServer(config) {
83
85
  args,
84
86
  credentials,
85
87
  });
88
+ const shaped = compactResult(def.method, result, verbose);
86
89
  return {
87
90
  content: [
88
- { type: "text", text: JSON.stringify(result, null, 2) },
91
+ { type: "text", text: JSON.stringify(shaped, null, 2) },
89
92
  ],
90
93
  };
91
94
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compacts MCP tool responses for agent consumption.
3
+ * When verbose=false (default), strips fields that bloat context windows
4
+ * without adding decision-relevant information.
5
+ */
6
+ export declare function compactResult(toolName: string, data: unknown, verbose: boolean): unknown;
package/dist/shaper.js ADDED
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Compacts MCP tool responses for agent consumption.
3
+ * When verbose=false (default), strips fields that bloat context windows
4
+ * without adding decision-relevant information.
5
+ */
6
+ // ---------------------------------------------------------------------------
7
+ // Helpers
8
+ // ---------------------------------------------------------------------------
9
+ function truncate(s, maxLen) {
10
+ if (typeof s !== "string")
11
+ return "";
12
+ if (s.length <= maxLen)
13
+ return s;
14
+ return s.slice(0, maxLen) + "...";
15
+ }
16
+ // Flatten outcomes into compact {marketId, outcomes: [{label, price}]}
17
+ function compactMarket(m) {
18
+ const src = m;
19
+ const outcomes = Array.isArray(src.outcomes)
20
+ ? src.outcomes.map((o) => ({
21
+ label: o.label,
22
+ price: o.price,
23
+ }))
24
+ : [];
25
+ return {
26
+ marketId: src.marketId,
27
+ title: src.title,
28
+ outcomes,
29
+ ...(src.volume24h != null && { volume24h: src.volume24h }),
30
+ ...(src.liquidity != null && { liquidity: src.liquidity }),
31
+ ...(src.status != null && src.status !== "active" && { status: src.status }),
32
+ };
33
+ }
34
+ // Standalone market (fetchMarket) -- slightly more detail since agent asked for one specific market
35
+ function compactSingleMarket(m) {
36
+ const src = m;
37
+ const outcomes = Array.isArray(src.outcomes)
38
+ ? src.outcomes.map((o) => ({
39
+ outcomeId: o.outcomeId,
40
+ label: o.label,
41
+ price: o.price,
42
+ }))
43
+ : [];
44
+ return {
45
+ marketId: src.marketId,
46
+ eventId: src.eventId,
47
+ title: src.title,
48
+ description: truncate(src.description, 200),
49
+ outcomes,
50
+ ...(src.resolutionDate != null && { resolutionDate: src.resolutionDate }),
51
+ ...(src.volume24h != null && { volume24h: src.volume24h }),
52
+ ...(src.liquidity != null && { liquidity: src.liquidity }),
53
+ ...(src.openInterest != null && { openInterest: src.openInterest }),
54
+ ...(src.status != null && { status: src.status }),
55
+ ...(src.tickSize != null && { tickSize: src.tickSize }),
56
+ };
57
+ }
58
+ const NESTED_MARKETS_LIMIT = 5;
59
+ function compactEvent(e) {
60
+ const src = e;
61
+ const allMarkets = Array.isArray(src.markets)
62
+ ? src.markets.map(compactMarket)
63
+ : [];
64
+ const markets = allMarkets.length > NESTED_MARKETS_LIMIT
65
+ ? allMarkets.slice(0, NESTED_MARKETS_LIMIT)
66
+ : allMarkets;
67
+ return {
68
+ id: src.id,
69
+ title: src.title,
70
+ description: truncate(src.description, 200),
71
+ markets,
72
+ ...(allMarkets.length > NESTED_MARKETS_LIMIT && {
73
+ _totalMarkets: allMarkets.length,
74
+ }),
75
+ ...(src.volume24h != null && { volume24h: src.volume24h }),
76
+ };
77
+ }
78
+ function compactBuildOrder(data) {
79
+ const src = data;
80
+ const { raw: _raw, signedOrder: _signed, ...rest } = src;
81
+ return rest;
82
+ }
83
+ const ORDER_BOOK_DEPTH = 10;
84
+ function compactOrderBook(data) {
85
+ const src = data;
86
+ const bids = Array.isArray(src.bids) ? src.bids.slice(0, ORDER_BOOK_DEPTH) : [];
87
+ const asks = Array.isArray(src.asks) ? src.asks.slice(0, ORDER_BOOK_DEPTH) : [];
88
+ return {
89
+ bids,
90
+ asks,
91
+ ...(Array.isArray(src.bids) && src.bids.length > ORDER_BOOK_DEPTH && {
92
+ _totalBids: src.bids.length,
93
+ }),
94
+ ...(Array.isArray(src.asks) && src.asks.length > ORDER_BOOK_DEPTH && {
95
+ _totalAsks: src.asks.length,
96
+ }),
97
+ };
98
+ }
99
+ const TRADES_LIMIT = 20;
100
+ function compactTrades(data) {
101
+ if (!Array.isArray(data))
102
+ return data;
103
+ const trades = data.slice(0, TRADES_LIMIT).map((t) => {
104
+ const src = t;
105
+ return {
106
+ price: src.price,
107
+ amount: src.amount,
108
+ side: src.side,
109
+ timestamp: src.timestamp,
110
+ };
111
+ });
112
+ return trades;
113
+ }
114
+ const OHLCV_LIMIT = 50;
115
+ function compactOHLCV(data) {
116
+ if (!Array.isArray(data))
117
+ return data;
118
+ return data.slice(0, OHLCV_LIMIT);
119
+ }
120
+ function compactOrder(o) {
121
+ const src = o;
122
+ return {
123
+ id: src.id,
124
+ marketId: src.marketId,
125
+ outcomeId: src.outcomeId,
126
+ side: src.side,
127
+ price: src.price,
128
+ amount: src.amount,
129
+ filled: src.filled,
130
+ remaining: src.remaining,
131
+ status: src.status,
132
+ };
133
+ }
134
+ function compactOrders(data) {
135
+ if (!Array.isArray(data))
136
+ return data;
137
+ return data.map(compactOrder);
138
+ }
139
+ // ---------------------------------------------------------------------------
140
+ // Per-tool dispatch
141
+ // ---------------------------------------------------------------------------
142
+ const COMPACTORS = {
143
+ fetchEvents: (data) => Array.isArray(data) ? data.map(compactEvent) : data,
144
+ fetchEvent: (data) => compactEvent(data),
145
+ fetchMarkets: (data) => Array.isArray(data) ? data.map(compactSingleMarket) : data,
146
+ fetchMarket: (data) => compactSingleMarket(data),
147
+ fetchMarketsPaginated: (data) => {
148
+ const src = data;
149
+ return {
150
+ data: Array.isArray(src.data)
151
+ ? src.data.map(compactSingleMarket)
152
+ : src.data,
153
+ total: src.total,
154
+ nextCursor: src.nextCursor,
155
+ };
156
+ },
157
+ buildOrder: (data) => compactBuildOrder(data),
158
+ fetchOrderBook: (data) => compactOrderBook(data),
159
+ fetchTrades: (data) => compactTrades(data),
160
+ fetchMyTrades: (data) => compactTrades(data),
161
+ fetchOHLCV: (data) => compactOHLCV(data),
162
+ fetchOrder: (data) => compactOrder(data),
163
+ fetchOpenOrders: (data) => compactOrders(data),
164
+ fetchClosedOrders: (data) => compactOrders(data),
165
+ fetchAllOrders: (data) => compactOrders(data),
166
+ createOrder: (data) => compactOrder(data),
167
+ cancelOrder: (data) => compactOrder(data),
168
+ };
169
+ // ---------------------------------------------------------------------------
170
+ // Public API
171
+ // ---------------------------------------------------------------------------
172
+ export function compactResult(toolName, data, verbose) {
173
+ if (verbose)
174
+ return data;
175
+ const compactor = COMPACTORS[toolName];
176
+ if (!compactor)
177
+ return data;
178
+ return compactor(data);
179
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmxt/mcp",
3
- "version": "2.30.2",
3
+ "version": "2.30.5",
4
4
  "description": "MCP server for PMXT - the unified prediction market API",
5
5
  "type": "module",
6
6
  "bin": {