@toromarket/mcp-server 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -81,7 +81,9 @@ var placeOrderSchema = import_zod.z.object({
81
81
  side: import_zod.z.enum(["BUY", "SELL"]),
82
82
  type: import_zod.z.enum(["LIMIT", "MARKET"]).default("LIMIT"),
83
83
  price: import_zod.z.coerce.number().min(0).max(1).optional(),
84
- quantity: import_zod.z.coerce.number().positive().max(1e5)
84
+ quantity: import_zod.z.coerce.number().positive().max(1e5),
85
+ reasoning: sanitized(1e3),
86
+ confidence: import_zod.z.coerce.number().min(0).max(1)
85
87
  });
86
88
  var cancelOrderSchema = import_zod.z.object({
87
89
  marketId: id,
@@ -90,7 +92,9 @@ var cancelOrderSchema = import_zod.z.object({
90
92
  var tradeCryptoSchema = import_zod.z.object({
91
93
  symbol: sanitized(20),
92
94
  side: import_zod.z.enum(["BUY", "SELL"]),
93
- quantity: import_zod.z.coerce.number().positive().max(1e5)
95
+ quantity: import_zod.z.coerce.number().positive().max(1e5),
96
+ reasoning: sanitized(1e3),
97
+ confidence: import_zod.z.coerce.number().min(0).max(1)
94
98
  });
95
99
  var postMarketCommentSchema = import_zod.z.object({
96
100
  marketId: id,
@@ -212,9 +216,11 @@ var PHASE1_TOOLS = [
212
216
  type: "number",
213
217
  description: "Price per share (0-1). Required for LIMIT orders. Ignored for MARKET orders."
214
218
  },
215
- quantity: { type: "number", description: "Share quantity" }
219
+ quantity: { type: "number", description: "Share quantity" },
220
+ reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
221
+ confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
216
222
  },
217
- required: ["marketId", "outcomeId", "side", "quantity"]
223
+ required: ["marketId", "outcomeId", "side", "quantity", "reasoning", "confidence"]
218
224
  }
219
225
  },
220
226
  {
@@ -263,9 +269,11 @@ var PHASE1_TOOLS = [
263
269
  properties: {
264
270
  symbol: { type: "string", description: "Symbol like BTC" },
265
271
  side: { type: "string", enum: ["BUY", "SELL"] },
266
- quantity: { type: "number", description: "Order size" }
272
+ quantity: { type: "number", description: "Order size" },
273
+ reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
274
+ confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
267
275
  },
268
- required: ["symbol", "side", "quantity"]
276
+ required: ["symbol", "side", "quantity", "reasoning", "confidence"]
269
277
  }
270
278
  }
271
279
  ];
@@ -633,13 +641,17 @@ var placeFundOrderSchema = import_zod.z.object({
633
641
  side: import_zod.z.enum(["BUY", "SELL"]),
634
642
  type: import_zod.z.enum(["LIMIT", "MARKET"]).default("LIMIT"),
635
643
  price: import_zod.z.coerce.number().min(0).max(1).optional(),
636
- quantity: import_zod.z.coerce.number().positive().max(1e5)
644
+ quantity: import_zod.z.coerce.number().positive().max(1e5),
645
+ reasoning: sanitized(1e3),
646
+ confidence: import_zod.z.coerce.number().min(0).max(1)
637
647
  });
638
648
  var tradeFundCryptoSchema = import_zod.z.object({
639
649
  fundId: id,
640
650
  symbol: sanitized(20),
641
651
  side: import_zod.z.enum(["BUY", "SELL"]),
642
- quantity: import_zod.z.coerce.number().positive().max(1e5)
652
+ quantity: import_zod.z.coerce.number().positive().max(1e5),
653
+ reasoning: sanitized(1e3),
654
+ confidence: import_zod.z.coerce.number().min(0).max(1)
643
655
  });
644
656
  var FUND_TRADING_TOOLS = [
645
657
  {
@@ -661,9 +673,11 @@ var FUND_TRADING_TOOLS = [
661
673
  type: "number",
662
674
  description: "Price per share (0-1). Required for LIMIT orders. Ignored for MARKET orders."
663
675
  },
664
- quantity: { type: "number", description: "Share quantity" }
676
+ quantity: { type: "number", description: "Share quantity" },
677
+ reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
678
+ confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
665
679
  },
666
- required: ["fundId", "marketId", "outcomeId", "side", "quantity"]
680
+ required: ["fundId", "marketId", "outcomeId", "side", "quantity", "reasoning", "confidence"]
667
681
  }
668
682
  },
669
683
  {
@@ -675,9 +689,11 @@ var FUND_TRADING_TOOLS = [
675
689
  fundId: { type: "string", description: "Your fund ID (from list_funds myFundId)" },
676
690
  symbol: { type: "string", description: "Symbol like BTC" },
677
691
  side: { type: "string", enum: ["BUY", "SELL"] },
678
- quantity: { type: "number", description: "Order size" }
692
+ quantity: { type: "number", description: "Order size" },
693
+ reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
694
+ confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
679
695
  },
680
- required: ["fundId", "symbol", "side", "quantity"]
696
+ required: ["fundId", "symbol", "side", "quantity", "reasoning", "confidence"]
681
697
  }
682
698
  },
683
699
  {
@@ -2504,7 +2520,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
2504
2520
  side: input.side,
2505
2521
  type: input.type,
2506
2522
  price: Number(price),
2507
- quantity: Number(input.quantity)
2523
+ quantity: Number(input.quantity),
2524
+ reasoning: input.reasoning,
2525
+ confidence: input.confidence
2508
2526
  });
2509
2527
  const remainingBalance = await fetchRemainingBalance(client);
2510
2528
  return { ...result, remainingBalance };
@@ -2531,7 +2549,13 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
2531
2549
  }
2532
2550
  case "trade_crypto": {
2533
2551
  const input = tradeCryptoSchema.parse(args);
2534
- const result = await client.portfolio.trade(input);
2552
+ const result = await client.portfolio.trade({
2553
+ symbol: input.symbol,
2554
+ side: input.side,
2555
+ quantity: input.quantity,
2556
+ reasoning: input.reasoning,
2557
+ confidence: input.confidence
2558
+ });
2535
2559
  const remainingBalance = await fetchRemainingBalance(client);
2536
2560
  return { ...result, remainingBalance };
2537
2561
  }
@@ -2725,7 +2749,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
2725
2749
  side: input.side,
2726
2750
  type: input.type,
2727
2751
  price,
2728
- quantity: input.quantity
2752
+ quantity: input.quantity,
2753
+ reasoning: input.reasoning,
2754
+ confidence: input.confidence
2729
2755
  });
2730
2756
  const fundOrderBalance = await fetchRemainingBalance(client);
2731
2757
  return { ...fundOrderResult, remainingBalance: fundOrderBalance };
@@ -2735,7 +2761,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
2735
2761
  const fundTradeResult = await client.funds.tradeCrypto(input.fundId, {
2736
2762
  symbol: input.symbol,
2737
2763
  side: input.side,
2738
- quantity: input.quantity
2764
+ quantity: input.quantity,
2765
+ reasoning: input.reasoning,
2766
+ confidence: input.confidence
2739
2767
  });
2740
2768
  const fundTradeBalance = await fetchRemainingBalance(client);
2741
2769
  return { ...fundTradeResult, remainingBalance: fundTradeBalance };
@@ -4149,8 +4177,18 @@ var TraceCollector = class {
4149
4177
  ...signals !== void 0 ? { signals } : {}
4150
4178
  };
4151
4179
  }
4152
- async beforeExecute(toolName) {
4153
- if (STATE_CHANGING_TOOLS.has(toolName) && !this.pendingReasoning) {
4180
+ async beforeExecute(toolName, args) {
4181
+ if (!STATE_CHANGING_TOOLS.has(toolName)) return;
4182
+ if (!this.pendingReasoning && args && typeof args === "object") {
4183
+ const a = args;
4184
+ if (typeof a.reasoning === "string" && a.reasoning.length > 0) {
4185
+ this.setReasoning(
4186
+ a.reasoning,
4187
+ typeof a.confidence === "number" ? a.confidence : void 0
4188
+ );
4189
+ }
4190
+ }
4191
+ if (!this.pendingReasoning) {
4154
4192
  throw new import_sdk8.ToromarketError(
4155
4193
  "Call log_reasoning before trading. Every trade requires a reasoning explanation.",
4156
4194
  400,