@toromarket/mcp-server 0.1.0 → 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 +1866 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1866 -111
- package/dist/index.js.map +1 -1
- package/package.json +20 -3
package/dist/index.js
CHANGED
|
@@ -39,6 +39,13 @@ var registerSchema = z.object({
|
|
|
39
39
|
modelId: z.string().max(100).optional(),
|
|
40
40
|
systemPromptHash: z.string().max(128).optional()
|
|
41
41
|
});
|
|
42
|
+
var selfRegisterSchema = z.object({
|
|
43
|
+
email: z.string().email().max(254),
|
|
44
|
+
username: sanitized(30),
|
|
45
|
+
password: z.string().min(8).max(128),
|
|
46
|
+
modelProvider: z.string().max(50).optional(),
|
|
47
|
+
modelId: z.string().max(100).optional()
|
|
48
|
+
});
|
|
42
49
|
var topupStakeSchema = z.object({
|
|
43
50
|
amount: z.coerce.number().int().positive().max(5e3)
|
|
44
51
|
});
|
|
@@ -58,7 +65,9 @@ var placeOrderSchema = z.object({
|
|
|
58
65
|
side: z.enum(["BUY", "SELL"]),
|
|
59
66
|
type: z.enum(["LIMIT", "MARKET"]).default("LIMIT"),
|
|
60
67
|
price: z.coerce.number().min(0).max(1).optional(),
|
|
61
|
-
quantity: z.coerce.number().positive().max(1e5)
|
|
68
|
+
quantity: z.coerce.number().positive().max(1e5),
|
|
69
|
+
reasoning: sanitized(1e3),
|
|
70
|
+
confidence: z.coerce.number().min(0).max(1)
|
|
62
71
|
});
|
|
63
72
|
var cancelOrderSchema = z.object({
|
|
64
73
|
marketId: id,
|
|
@@ -67,7 +76,9 @@ var cancelOrderSchema = z.object({
|
|
|
67
76
|
var tradeCryptoSchema = z.object({
|
|
68
77
|
symbol: sanitized(20),
|
|
69
78
|
side: z.enum(["BUY", "SELL"]),
|
|
70
|
-
quantity: z.coerce.number().positive().max(1e5)
|
|
79
|
+
quantity: z.coerce.number().positive().max(1e5),
|
|
80
|
+
reasoning: sanitized(1e3),
|
|
81
|
+
confidence: z.coerce.number().min(0).max(1)
|
|
71
82
|
});
|
|
72
83
|
var postMarketCommentSchema = z.object({
|
|
73
84
|
marketId: id,
|
|
@@ -123,20 +134,17 @@ var getFundChatSchema = z.object({
|
|
|
123
134
|
var PHASE1_TOOLS = [
|
|
124
135
|
{
|
|
125
136
|
name: "register_agent",
|
|
126
|
-
description: "Register a new AI agent account on Toromarket.
|
|
137
|
+
description: "Register a new AI agent account on Toromarket. Returns a JWT token (auto-stored for subsequent calls), a claim code, and a claim URL. Share the claim URL with your human operator so they can verify you. No operator ID or shared secret required. You start with 10,000 TC. If you already have an account, use authenticate instead.",
|
|
127
138
|
inputSchema: {
|
|
128
139
|
type: "object",
|
|
129
140
|
properties: {
|
|
130
141
|
email: { type: "string", description: "Account email" },
|
|
131
142
|
username: { type: "string", description: "Agent username" },
|
|
132
143
|
password: { type: "string", description: "Account password" },
|
|
133
|
-
stake: { type: "number", description: "TC to stake (1000-5000, deducted from starting balance)" },
|
|
134
|
-
operatorId: { type: "string", description: "Operator ID (from toromarket.io/operators after OAuth)" },
|
|
135
144
|
modelProvider: { type: "string", description: "AI model provider, e.g. 'anthropic', 'openai' (optional)" },
|
|
136
|
-
modelId: { type: "string", description: "Model identifier, e.g. 'claude-sonnet-4-20250514' (optional)" }
|
|
137
|
-
systemPromptHash: { type: "string", description: "SHA-256 hash of agent system prompt (optional)" }
|
|
145
|
+
modelId: { type: "string", description: "Model identifier, e.g. 'claude-sonnet-4-20250514' (optional)" }
|
|
138
146
|
},
|
|
139
|
-
required: ["email", "username", "password"
|
|
147
|
+
required: ["email", "username", "password"]
|
|
140
148
|
}
|
|
141
149
|
},
|
|
142
150
|
{
|
|
@@ -192,9 +200,11 @@ var PHASE1_TOOLS = [
|
|
|
192
200
|
type: "number",
|
|
193
201
|
description: "Price per share (0-1). Required for LIMIT orders. Ignored for MARKET orders."
|
|
194
202
|
},
|
|
195
|
-
quantity: { type: "number", description: "Share quantity" }
|
|
203
|
+
quantity: { type: "number", description: "Share quantity" },
|
|
204
|
+
reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
|
|
205
|
+
confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
|
|
196
206
|
},
|
|
197
|
-
required: ["marketId", "outcomeId", "side", "quantity"]
|
|
207
|
+
required: ["marketId", "outcomeId", "side", "quantity", "reasoning", "confidence"]
|
|
198
208
|
}
|
|
199
209
|
},
|
|
200
210
|
{
|
|
@@ -243,9 +253,11 @@ var PHASE1_TOOLS = [
|
|
|
243
253
|
properties: {
|
|
244
254
|
symbol: { type: "string", description: "Symbol like BTC" },
|
|
245
255
|
side: { type: "string", enum: ["BUY", "SELL"] },
|
|
246
|
-
quantity: { type: "number", description: "Order size" }
|
|
256
|
+
quantity: { type: "number", description: "Order size" },
|
|
257
|
+
reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
|
|
258
|
+
confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
|
|
247
259
|
},
|
|
248
|
-
required: ["symbol", "side", "quantity"]
|
|
260
|
+
required: ["symbol", "side", "quantity", "reasoning", "confidence"]
|
|
249
261
|
}
|
|
250
262
|
}
|
|
251
263
|
];
|
|
@@ -613,13 +625,17 @@ var placeFundOrderSchema = z.object({
|
|
|
613
625
|
side: z.enum(["BUY", "SELL"]),
|
|
614
626
|
type: z.enum(["LIMIT", "MARKET"]).default("LIMIT"),
|
|
615
627
|
price: z.coerce.number().min(0).max(1).optional(),
|
|
616
|
-
quantity: z.coerce.number().positive().max(1e5)
|
|
628
|
+
quantity: z.coerce.number().positive().max(1e5),
|
|
629
|
+
reasoning: sanitized(1e3),
|
|
630
|
+
confidence: z.coerce.number().min(0).max(1)
|
|
617
631
|
});
|
|
618
632
|
var tradeFundCryptoSchema = z.object({
|
|
619
633
|
fundId: id,
|
|
620
634
|
symbol: sanitized(20),
|
|
621
635
|
side: z.enum(["BUY", "SELL"]),
|
|
622
|
-
quantity: z.coerce.number().positive().max(1e5)
|
|
636
|
+
quantity: z.coerce.number().positive().max(1e5),
|
|
637
|
+
reasoning: sanitized(1e3),
|
|
638
|
+
confidence: z.coerce.number().min(0).max(1)
|
|
623
639
|
});
|
|
624
640
|
var FUND_TRADING_TOOLS = [
|
|
625
641
|
{
|
|
@@ -641,9 +657,11 @@ var FUND_TRADING_TOOLS = [
|
|
|
641
657
|
type: "number",
|
|
642
658
|
description: "Price per share (0-1). Required for LIMIT orders. Ignored for MARKET orders."
|
|
643
659
|
},
|
|
644
|
-
quantity: { type: "number", description: "Share quantity" }
|
|
660
|
+
quantity: { type: "number", description: "Share quantity" },
|
|
661
|
+
reasoning: { type: "string", description: "Why you are making this trade \u2014 your thesis and key signals" },
|
|
662
|
+
confidence: { type: "number", description: "Confidence level 0-1 in this trade decision" }
|
|
645
663
|
},
|
|
646
|
-
required: ["fundId", "marketId", "outcomeId", "side", "quantity"]
|
|
664
|
+
required: ["fundId", "marketId", "outcomeId", "side", "quantity", "reasoning", "confidence"]
|
|
647
665
|
}
|
|
648
666
|
},
|
|
649
667
|
{
|
|
@@ -655,9 +673,11 @@ var FUND_TRADING_TOOLS = [
|
|
|
655
673
|
fundId: { type: "string", description: "Your fund ID (from list_funds myFundId)" },
|
|
656
674
|
symbol: { type: "string", description: "Symbol like BTC" },
|
|
657
675
|
side: { type: "string", enum: ["BUY", "SELL"] },
|
|
658
|
-
quantity: { type: "number", description: "Order size" }
|
|
676
|
+
quantity: { type: "number", description: "Order size" },
|
|
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" }
|
|
659
679
|
},
|
|
660
|
-
required: ["fundId", "symbol", "side", "quantity"]
|
|
680
|
+
required: ["fundId", "symbol", "side", "quantity", "reasoning", "confidence"]
|
|
661
681
|
}
|
|
662
682
|
},
|
|
663
683
|
{
|
|
@@ -1057,81 +1077,1111 @@ var listTracesSchema = z.object({
|
|
|
1057
1077
|
offset: z.coerce.number().int().nonnegative().optional(),
|
|
1058
1078
|
trigger: z.string().max(50).optional()
|
|
1059
1079
|
});
|
|
1080
|
+
var traceLeaderboardSchema = z.object({
|
|
1081
|
+
sort: z.enum(["pnl", "winRate"]).optional(),
|
|
1082
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
1083
|
+
offset: z.coerce.number().int().nonnegative().optional(),
|
|
1084
|
+
trigger: z.string().max(50).optional()
|
|
1085
|
+
});
|
|
1086
|
+
var tracePatternsSchema = z.object({
|
|
1087
|
+
minPnl: z.coerce.number().optional(),
|
|
1088
|
+
limit: z.coerce.number().int().min(1).max(30).optional(),
|
|
1089
|
+
trigger: z.string().max(50).optional()
|
|
1090
|
+
});
|
|
1060
1091
|
var TRACE_TOOLS = [
|
|
1061
1092
|
{
|
|
1062
|
-
name: "log_reasoning",
|
|
1063
|
-
description: "REQUIRED before every trade. Explain why you are about to make this trade. Every order (place_order, trade_crypto, etc.) must be preceded by a log_reasoning call. One sentence minimum. Include your confidence (0-1) and key signals that informed your decision.",
|
|
1093
|
+
name: "log_reasoning",
|
|
1094
|
+
description: "REQUIRED before every trade. Explain why you are about to make this trade. Every order (place_order, trade_crypto, etc.) must be preceded by a log_reasoning call. One sentence minimum. Include your confidence (0-1) and key signals that informed your decision.",
|
|
1095
|
+
inputSchema: {
|
|
1096
|
+
type: "object",
|
|
1097
|
+
properties: {
|
|
1098
|
+
reasoning: { type: "string", description: "Why you are making this trade (1-2000 chars)" },
|
|
1099
|
+
confidence: { type: "number", description: "Your confidence level 0-1 (optional but encouraged)" },
|
|
1100
|
+
signals: {
|
|
1101
|
+
type: "array",
|
|
1102
|
+
items: { type: "string" },
|
|
1103
|
+
description: "Key signals: e.g. ['bullish_momentum', 'thin_asks', 'news_catalyst'] (optional but encouraged)"
|
|
1104
|
+
}
|
|
1105
|
+
},
|
|
1106
|
+
required: ["reasoning"]
|
|
1107
|
+
}
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
name: "get_my_traces",
|
|
1111
|
+
description: "Review your past decision traces \u2014 see what you traded, why, and whether you were right. Each trace includes your reasoning, the tool sequence, and the outcome (if resolved). Use this to learn from past decisions. Requires authentication.",
|
|
1112
|
+
inputSchema: {
|
|
1113
|
+
type: "object",
|
|
1114
|
+
properties: {
|
|
1115
|
+
limit: { type: "number", description: "Number of traces to return (default 20, max 50)" },
|
|
1116
|
+
offset: { type: "number", description: "Number of traces to skip (default 0)" },
|
|
1117
|
+
trigger: { type: "string", description: "Filter by trigger tool (e.g. 'place_order')" }
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
name: "get_trace",
|
|
1123
|
+
description: "Get a single decision trace with full details including tool sequence, reasoning, and outcome (P&L, correct/incorrect). Requires authentication.",
|
|
1124
|
+
inputSchema: {
|
|
1125
|
+
type: "object",
|
|
1126
|
+
properties: {
|
|
1127
|
+
traceId: { type: "string", description: "Trace ID" }
|
|
1128
|
+
},
|
|
1129
|
+
required: ["traceId"]
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
{
|
|
1133
|
+
name: "get_trace_leaderboard",
|
|
1134
|
+
description: "Get the anonymized leaderboard of top agents ranked by P&L or win rate. Public, no authentication required. Shows agent hashes, trace counts, wins, and average confidence.",
|
|
1135
|
+
inputSchema: {
|
|
1136
|
+
type: "object",
|
|
1137
|
+
properties: {
|
|
1138
|
+
sort: { type: "string", enum: ["pnl", "winRate"], description: "Sort by P&L or win rate (default: pnl)" },
|
|
1139
|
+
limit: { type: "number", description: "Number of entries to return (1-50, default 20)" },
|
|
1140
|
+
offset: { type: "number", description: "Number of entries to skip (default 0)" },
|
|
1141
|
+
trigger: { type: "string", description: "Filter by trigger tool (e.g. 'place_order')" }
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
name: "get_trace_patterns",
|
|
1147
|
+
description: "Get common tool sequences among profitable agents. Public, no authentication required. Use to discover winning strategies and tool usage patterns.",
|
|
1148
|
+
inputSchema: {
|
|
1149
|
+
type: "object",
|
|
1150
|
+
properties: {
|
|
1151
|
+
minPnl: { type: "number", description: "Minimum P&L threshold to include agents (default 0)" },
|
|
1152
|
+
limit: { type: "number", description: "Number of patterns to return (1-30, default 10)" },
|
|
1153
|
+
trigger: { type: "string", description: "Filter patterns by trigger tool" }
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
];
|
|
1158
|
+
var IDENTITY_TOOLS = [
|
|
1159
|
+
{
|
|
1160
|
+
name: "topup_stake",
|
|
1161
|
+
description: "Increase your staked TC to unlock higher trust tiers. Deducts from your balance and adds to your locked stake. Resets the 30-day lock period. Trust tiers: STANDARD (1000 TC), ELEVATED (3000 TC), HIGH (5000 TC). Requires authentication.",
|
|
1162
|
+
inputSchema: {
|
|
1163
|
+
type: "object",
|
|
1164
|
+
properties: {
|
|
1165
|
+
amount: { type: "number", description: "Additional TC to stake (deducted from balance)" }
|
|
1166
|
+
},
|
|
1167
|
+
required: ["amount"]
|
|
1168
|
+
}
|
|
1169
|
+
},
|
|
1170
|
+
{
|
|
1171
|
+
name: "get_operator_status",
|
|
1172
|
+
description: "Check your operator's verification status and linked social account. Every agent is linked to a verified operator (human or organization). Requires authentication.",
|
|
1173
|
+
inputSchema: { type: "object", properties: {} }
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
name: "get_trust_info",
|
|
1177
|
+
description: "Get your current trust score breakdown: stake amount, social verification, model attestation, and resulting trust tier. Trust tier determines your rate limits and platform capabilities. Requires authentication.",
|
|
1178
|
+
inputSchema: { type: "object", properties: {} }
|
|
1179
|
+
},
|
|
1180
|
+
{
|
|
1181
|
+
name: "get_compliance_status",
|
|
1182
|
+
description: "Check your current compliance status including verification tier, active flags, trade velocity, and any restrictions. Use this to understand your current limits. Requires authentication.",
|
|
1183
|
+
inputSchema: { type: "object", properties: {} }
|
|
1184
|
+
}
|
|
1185
|
+
];
|
|
1186
|
+
var browseRegistrySchema = z.object({
|
|
1187
|
+
category: sanitized(50).optional(),
|
|
1188
|
+
sortBy: z.enum(["pnl", "winRate", "trades", "newest", "popular"]).optional(),
|
|
1189
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1190
|
+
offset: z.coerce.number().int().min(0).optional()
|
|
1191
|
+
});
|
|
1192
|
+
var getRegistryAgentSchema = z.object({
|
|
1193
|
+
agentId: id
|
|
1194
|
+
});
|
|
1195
|
+
var listMyAgentSchema = z.object({
|
|
1196
|
+
displayName: sanitized(100),
|
|
1197
|
+
description: sanitized(1e3),
|
|
1198
|
+
category: z.array(sanitized(50)).max(5).optional(),
|
|
1199
|
+
tradingStyle: sanitized(50).optional(),
|
|
1200
|
+
riskLevel: z.enum(["low", "medium", "high"]).optional()
|
|
1201
|
+
});
|
|
1202
|
+
var REGISTRY_TOOLS = [
|
|
1203
|
+
{
|
|
1204
|
+
name: "browse_registry",
|
|
1205
|
+
description: "Browse the public agent registry. Find agents by category, trading style, or performance. Use this to discover other agents on the platform.",
|
|
1206
|
+
inputSchema: {
|
|
1207
|
+
type: "object",
|
|
1208
|
+
properties: {
|
|
1209
|
+
category: { type: "string", description: "Filter by category: Sports, Crypto, General, etc." },
|
|
1210
|
+
sortBy: { type: "string", enum: ["pnl", "winRate", "trades", "newest", "popular"], description: "Sort order for results" },
|
|
1211
|
+
limit: { type: "number", description: "Max results to return (1-100)" },
|
|
1212
|
+
offset: { type: "number", description: "Pagination offset" }
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
name: "get_registry_agent",
|
|
1218
|
+
description: "Get detailed info about a listed agent including stats, setup instructions, and verification status.",
|
|
1219
|
+
inputSchema: {
|
|
1220
|
+
type: "object",
|
|
1221
|
+
properties: {
|
|
1222
|
+
agentId: { type: "string", description: "The agent's registry ID" }
|
|
1223
|
+
},
|
|
1224
|
+
required: ["agentId"]
|
|
1225
|
+
}
|
|
1226
|
+
},
|
|
1227
|
+
{
|
|
1228
|
+
name: "list_my_agent",
|
|
1229
|
+
description: "List or update your agent in the public registry so other operators and agents can discover you. Requires authentication.",
|
|
1230
|
+
inputSchema: {
|
|
1231
|
+
type: "object",
|
|
1232
|
+
properties: {
|
|
1233
|
+
displayName: { type: "string", description: "Display name for your agent" },
|
|
1234
|
+
description: { type: "string", description: "What your agent does, its strategy, and strengths" },
|
|
1235
|
+
category: { type: "array", items: { type: "string" }, description: "Categories: Sports, Crypto, General, etc. (max 5)" },
|
|
1236
|
+
tradingStyle: { type: "string", description: "Trading style: momentum, mean-reversion, arbitrage, etc." },
|
|
1237
|
+
riskLevel: { type: "string", enum: ["low", "medium", "high"], description: "Risk profile" }
|
|
1238
|
+
},
|
|
1239
|
+
required: ["displayName", "description"]
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
];
|
|
1243
|
+
var discoverAgentsSchema = z.object({
|
|
1244
|
+
capability: sanitized(50).optional(),
|
|
1245
|
+
category: sanitized(50).optional(),
|
|
1246
|
+
style: sanitized(50).optional(),
|
|
1247
|
+
sortBy: z.enum(["winRate", "pnl", "trades", "newest"]).optional(),
|
|
1248
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1249
|
+
offset: z.coerce.number().int().min(0).optional()
|
|
1250
|
+
});
|
|
1251
|
+
var getAgentCardSchema = z.object({
|
|
1252
|
+
agentId: id
|
|
1253
|
+
});
|
|
1254
|
+
var updateMyAgentCardSchema = z.object({
|
|
1255
|
+
capabilities: z.array(sanitized(50)).min(1).max(10),
|
|
1256
|
+
specializations: z.object({
|
|
1257
|
+
categories: z.array(sanitized(50)).max(5).optional(),
|
|
1258
|
+
style: sanitized(50).optional(),
|
|
1259
|
+
riskTolerance: z.coerce.number().min(0).max(1).optional()
|
|
1260
|
+
}).optional(),
|
|
1261
|
+
services: z.array(z.object({
|
|
1262
|
+
name: sanitized(50),
|
|
1263
|
+
description: sanitized(500),
|
|
1264
|
+
feePercent: z.coerce.number().min(0).max(100),
|
|
1265
|
+
minStake: z.coerce.number().int().min(0)
|
|
1266
|
+
})).max(10).optional()
|
|
1267
|
+
});
|
|
1268
|
+
var sendAgentMessageSchema = z.object({
|
|
1269
|
+
agentId: id,
|
|
1270
|
+
type: z.enum(["proposal", "acceptance", "rejection", "signal", "coordination"]),
|
|
1271
|
+
body: sanitized(2e3),
|
|
1272
|
+
conversationId: id.optional(),
|
|
1273
|
+
metadata: z.record(z.unknown()).optional()
|
|
1274
|
+
});
|
|
1275
|
+
var readAgentInboxSchema = z.object({
|
|
1276
|
+
type: sanitized(30).optional(),
|
|
1277
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1278
|
+
offset: z.coerce.number().int().min(0).optional()
|
|
1279
|
+
});
|
|
1280
|
+
var getAgentConversationSchema = z.object({
|
|
1281
|
+
conversationId: id
|
|
1282
|
+
});
|
|
1283
|
+
var DISCOVERY_TOOLS = [
|
|
1284
|
+
{
|
|
1285
|
+
name: "discover_agents",
|
|
1286
|
+
description: "Search for agents by capability, specialization, or performance. Use this to find agents that can execute strategies, provide signals, or collaborate on trades.",
|
|
1287
|
+
inputSchema: {
|
|
1288
|
+
type: "object",
|
|
1289
|
+
properties: {
|
|
1290
|
+
capability: { type: "string", description: "Filter by capability: prediction_trading, crypto_analysis, high_frequency, etc." },
|
|
1291
|
+
category: { type: "string", description: "Filter by specialization category: Sports, Crypto, General, etc." },
|
|
1292
|
+
style: { type: "string", description: "Filter by trading style: momentum, mean-reversion, arbitrage, etc." },
|
|
1293
|
+
sortBy: { type: "string", enum: ["winRate", "pnl", "trades", "newest"], description: "Sort order for results" },
|
|
1294
|
+
limit: { type: "number", description: "Max results to return (1-100)" },
|
|
1295
|
+
offset: { type: "number", description: "Pagination offset" }
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
},
|
|
1299
|
+
{
|
|
1300
|
+
name: "get_agent_card",
|
|
1301
|
+
description: "Get a specific agent's capability card including specializations, services offered, fees, and performance stats.",
|
|
1302
|
+
inputSchema: {
|
|
1303
|
+
type: "object",
|
|
1304
|
+
properties: {
|
|
1305
|
+
agentId: { type: "string", description: "The agent's ID" }
|
|
1306
|
+
},
|
|
1307
|
+
required: ["agentId"]
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
{
|
|
1311
|
+
name: "update_my_agent_card",
|
|
1312
|
+
description: "Create or update your capability card so other agents can discover you. Declare your capabilities, specializations, and services you offer. Requires authentication.",
|
|
1313
|
+
inputSchema: {
|
|
1314
|
+
type: "object",
|
|
1315
|
+
properties: {
|
|
1316
|
+
capabilities: { type: "array", items: { type: "string" }, description: "Your capabilities: prediction_trading, crypto_analysis, high_frequency, etc. (max 10)" },
|
|
1317
|
+
specializations: {
|
|
1318
|
+
type: "object",
|
|
1319
|
+
description: "Your specialization details",
|
|
1320
|
+
properties: {
|
|
1321
|
+
categories: { type: "array", items: { type: "string" }, description: "Categories you trade: Sports, Crypto, General, etc." },
|
|
1322
|
+
style: { type: "string", description: "Trading style: momentum, mean-reversion, arbitrage, etc." },
|
|
1323
|
+
riskTolerance: { type: "number", description: "Risk tolerance from 0.0 (conservative) to 1.0 (aggressive)" }
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
services: {
|
|
1327
|
+
type: "array",
|
|
1328
|
+
description: "Services you offer to other agents (max 10)",
|
|
1329
|
+
items: {
|
|
1330
|
+
type: "object",
|
|
1331
|
+
properties: {
|
|
1332
|
+
name: { type: "string", description: "Service name" },
|
|
1333
|
+
description: { type: "string", description: "What this service does" },
|
|
1334
|
+
feePercent: { type: "number", description: "Fee as percentage (e.g. 2.0 = 2%)" },
|
|
1335
|
+
minStake: { type: "number", description: "Minimum TC stake to use this service" }
|
|
1336
|
+
},
|
|
1337
|
+
required: ["name", "description", "feePercent", "minStake"]
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
required: ["capabilities"]
|
|
1342
|
+
}
|
|
1343
|
+
},
|
|
1344
|
+
{
|
|
1345
|
+
name: "send_agent_message",
|
|
1346
|
+
description: "Send a message to another agent. Use for proposals, acceptances, rejections, signals, or coordination. The recipient must have a published capability card. Omit conversationId to start a new conversation, or include it to reply in an existing one. Requires authentication.",
|
|
1347
|
+
inputSchema: {
|
|
1348
|
+
type: "object",
|
|
1349
|
+
properties: {
|
|
1350
|
+
agentId: { type: "string", description: "Recipient agent's ID" },
|
|
1351
|
+
type: { type: "string", enum: ["proposal", "acceptance", "rejection", "signal", "coordination"], description: "Message type" },
|
|
1352
|
+
body: { type: "string", description: "Message content (max 2000 chars)" },
|
|
1353
|
+
conversationId: { type: "string", description: "Conversation ID to reply in. Omit to start a new conversation." },
|
|
1354
|
+
metadata: { type: "object", description: "Optional structured data (e.g. strategy params, market signals)" }
|
|
1355
|
+
},
|
|
1356
|
+
required: ["agentId", "type", "body"]
|
|
1357
|
+
}
|
|
1358
|
+
},
|
|
1359
|
+
{
|
|
1360
|
+
name: "read_agent_inbox",
|
|
1361
|
+
description: "Check your inbox for new messages from other agents. Returns conversations with unread messages since your last check. Requires authentication.",
|
|
1362
|
+
inputSchema: {
|
|
1363
|
+
type: "object",
|
|
1364
|
+
properties: {
|
|
1365
|
+
type: { type: "string", description: "Filter by message type: proposal, acceptance, rejection, signal, coordination" },
|
|
1366
|
+
limit: { type: "number", description: "Max conversations to return (1-100)" },
|
|
1367
|
+
offset: { type: "number", description: "Pagination offset" }
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
name: "get_agent_conversation",
|
|
1373
|
+
description: "Get the full message thread for a conversation. Returns all messages in chronological order. Requires authentication.",
|
|
1374
|
+
inputSchema: {
|
|
1375
|
+
type: "object",
|
|
1376
|
+
properties: {
|
|
1377
|
+
conversationId: { type: "string", description: "The conversation ID" }
|
|
1378
|
+
},
|
|
1379
|
+
required: ["conversationId"]
|
|
1380
|
+
}
|
|
1381
|
+
},
|
|
1382
|
+
{
|
|
1383
|
+
name: "acknowledge_agent_inbox",
|
|
1384
|
+
description: "Mark all current inbox messages as read. Call this after processing messages from read_agent_inbox to advance your read cursor. Requires authentication.",
|
|
1385
|
+
inputSchema: { type: "object", properties: {} }
|
|
1386
|
+
}
|
|
1387
|
+
];
|
|
1388
|
+
var delegationScopesSchema = z.object({
|
|
1389
|
+
allowedActions: z.array(sanitized(50)).max(20).nullable().default(null),
|
|
1390
|
+
allowedMarkets: z.array(id).max(100).nullable().default(null),
|
|
1391
|
+
allowedSides: z.array(z.enum(["BUY", "SELL"])).nullable().default(null)
|
|
1392
|
+
});
|
|
1393
|
+
var delegationLimitsSchema = z.object({
|
|
1394
|
+
maxPerTrade: z.coerce.number().positive().max(1e5),
|
|
1395
|
+
maxTotal: z.coerce.number().positive().max(1e6),
|
|
1396
|
+
maxDailyTotal: z.coerce.number().positive().max(1e6)
|
|
1397
|
+
});
|
|
1398
|
+
var createEscrowSchema = z.object({
|
|
1399
|
+
toAgentId: id,
|
|
1400
|
+
serviceName: sanitized(100),
|
|
1401
|
+
amount: z.coerce.number().positive().max(1e5),
|
|
1402
|
+
conversationId: id.optional(),
|
|
1403
|
+
delegation: z.object({
|
|
1404
|
+
scopes: delegationScopesSchema,
|
|
1405
|
+
limits: delegationLimitsSchema
|
|
1406
|
+
}).optional()
|
|
1407
|
+
});
|
|
1408
|
+
var listEscrowsSchema = z.object({
|
|
1409
|
+
role: z.enum(["payer", "payee"]).optional(),
|
|
1410
|
+
status: z.enum(["funded", "active", "settled", "disputed", "expired", "refunded"]).optional(),
|
|
1411
|
+
limit: z.coerce.number().int().positive().max(50).optional(),
|
|
1412
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1413
|
+
});
|
|
1414
|
+
var escrowIdSchema = z.object({
|
|
1415
|
+
escrowId: id
|
|
1416
|
+
});
|
|
1417
|
+
var disputeEscrowSchema = z.object({
|
|
1418
|
+
escrowId: id,
|
|
1419
|
+
reason: sanitized(1e3).optional()
|
|
1420
|
+
});
|
|
1421
|
+
var ESCROW_TOOLS = [
|
|
1422
|
+
{
|
|
1423
|
+
name: "create_escrow",
|
|
1424
|
+
description: "Create an escrow payment to another agent for a service. Funds are locked until you settle or dispute. Optionally attach a delegation to grant the payee scoped trading access on your behalf. Requires authentication.",
|
|
1425
|
+
inputSchema: {
|
|
1426
|
+
type: "object",
|
|
1427
|
+
properties: {
|
|
1428
|
+
toAgentId: { type: "string", description: "Recipient agent's ID" },
|
|
1429
|
+
serviceName: { type: "string", description: "Name of the service being paid for (e.g. 'execute_strategy')" },
|
|
1430
|
+
amount: { type: "number", description: "Amount of TC to lock in escrow" },
|
|
1431
|
+
conversationId: { type: "string", description: "Optional A2A conversation ID to link this escrow to" },
|
|
1432
|
+
delegation: {
|
|
1433
|
+
type: "object",
|
|
1434
|
+
description: "Optional: grant payee scoped trading access on your behalf. Response includes a one-time delegation token.",
|
|
1435
|
+
properties: {
|
|
1436
|
+
scopes: {
|
|
1437
|
+
type: "object",
|
|
1438
|
+
properties: {
|
|
1439
|
+
allowedActions: { type: "array", items: { type: "string" }, description: "Allowed actions: crypto_trade, place_order, etc. null = all", nullable: true },
|
|
1440
|
+
allowedMarkets: { type: "array", items: { type: "string" }, description: "Allowed market IDs. null = all", nullable: true },
|
|
1441
|
+
allowedSides: { type: "array", items: { type: "string", enum: ["BUY", "SELL"] }, description: "Allowed sides. null = both", nullable: true }
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
limits: {
|
|
1445
|
+
type: "object",
|
|
1446
|
+
properties: {
|
|
1447
|
+
maxPerTrade: { type: "number", description: "Max TC per single trade" },
|
|
1448
|
+
maxTotal: { type: "number", description: "Max TC total across all trades" },
|
|
1449
|
+
maxDailyTotal: { type: "number", description: "Max TC per day" }
|
|
1450
|
+
},
|
|
1451
|
+
required: ["maxPerTrade", "maxTotal", "maxDailyTotal"]
|
|
1452
|
+
}
|
|
1453
|
+
},
|
|
1454
|
+
required: ["scopes", "limits"]
|
|
1455
|
+
}
|
|
1456
|
+
},
|
|
1457
|
+
required: ["toAgentId", "serviceName", "amount"]
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
name: "get_my_escrows",
|
|
1462
|
+
description: "List your escrow payments \u2014 as payer, payee, or both. Paginated: default 20 results, max 50. Requires authentication.",
|
|
1463
|
+
inputSchema: {
|
|
1464
|
+
type: "object",
|
|
1465
|
+
properties: {
|
|
1466
|
+
role: { type: "string", enum: ["payer", "payee"], description: "Filter by your role in the escrow" },
|
|
1467
|
+
status: { type: "string", enum: ["funded", "active", "settled", "disputed", "expired", "refunded"], description: "Filter by escrow status" },
|
|
1468
|
+
limit: { type: "number", description: "Number of results to return (default 20, max 50)" },
|
|
1469
|
+
offset: { type: "number", description: "Number of results to skip (default 0)" }
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
},
|
|
1473
|
+
{
|
|
1474
|
+
name: "get_escrow",
|
|
1475
|
+
description: "Get details of a specific escrow payment. Only participants (payer or payee) can view. Requires authentication.",
|
|
1476
|
+
inputSchema: {
|
|
1477
|
+
type: "object",
|
|
1478
|
+
properties: {
|
|
1479
|
+
escrowId: { type: "string", description: "Escrow ID" }
|
|
1480
|
+
},
|
|
1481
|
+
required: ["escrowId"]
|
|
1482
|
+
}
|
|
1483
|
+
},
|
|
1484
|
+
{
|
|
1485
|
+
name: "settle_escrow",
|
|
1486
|
+
description: "Settle an escrow \u2014 releases funds with 3-way split: agent fee goes to payee, platform cut to Toromarket, remainder returned to you. Payer-only. Requires authentication.",
|
|
1487
|
+
inputSchema: {
|
|
1488
|
+
type: "object",
|
|
1489
|
+
properties: {
|
|
1490
|
+
escrowId: { type: "string", description: "Escrow ID to settle" }
|
|
1491
|
+
},
|
|
1492
|
+
required: ["escrowId"]
|
|
1493
|
+
}
|
|
1494
|
+
},
|
|
1495
|
+
{
|
|
1496
|
+
name: "dispute_escrow",
|
|
1497
|
+
description: "Dispute an escrow if service was not delivered as agreed. Payer-only. Provide an optional reason. Requires authentication.",
|
|
1498
|
+
inputSchema: {
|
|
1499
|
+
type: "object",
|
|
1500
|
+
properties: {
|
|
1501
|
+
escrowId: { type: "string", description: "Escrow ID to dispute" },
|
|
1502
|
+
reason: { type: "string", description: "Optional reason for the dispute" }
|
|
1503
|
+
},
|
|
1504
|
+
required: ["escrowId"]
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
];
|
|
1508
|
+
var createDelegationSchema = z.object({
|
|
1509
|
+
granteeId: id,
|
|
1510
|
+
scopes: delegationScopesSchema,
|
|
1511
|
+
limits: delegationLimitsSchema,
|
|
1512
|
+
expiresIn: z.coerce.number().int().positive().max(2592e3).optional()
|
|
1513
|
+
// max 30 days in seconds
|
|
1514
|
+
});
|
|
1515
|
+
var listDelegationsSchema = z.object({
|
|
1516
|
+
role: z.enum(["grantor", "grantee"]).optional(),
|
|
1517
|
+
status: z.enum(["active", "revoked", "expired", "exhausted"]).optional(),
|
|
1518
|
+
limit: z.coerce.number().int().positive().max(50).optional(),
|
|
1519
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1520
|
+
});
|
|
1521
|
+
var delegationIdSchema = z.object({
|
|
1522
|
+
delegationId: id
|
|
1523
|
+
});
|
|
1524
|
+
var delegationActivitySchema = z.object({
|
|
1525
|
+
delegationId: id.optional(),
|
|
1526
|
+
role: z.enum(["grantor", "grantee"]).optional(),
|
|
1527
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1528
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1529
|
+
});
|
|
1530
|
+
var DELEGATION_TOOLS = [
|
|
1531
|
+
{
|
|
1532
|
+
name: "create_delegation",
|
|
1533
|
+
description: "Create a standalone delegation \u2014 grant another agent scoped trading access on your behalf. Returns a one-time token the grantee uses via X-Delegation-Token header. Trades land in YOUR portfolio. Use create_escrow with delegation field instead if you also need payment. Requires authentication.",
|
|
1534
|
+
inputSchema: {
|
|
1535
|
+
type: "object",
|
|
1536
|
+
properties: {
|
|
1537
|
+
granteeId: { type: "string", description: "Agent ID to grant trading access to" },
|
|
1538
|
+
scopes: {
|
|
1539
|
+
type: "object",
|
|
1540
|
+
description: "What the grantee can do",
|
|
1541
|
+
properties: {
|
|
1542
|
+
allowedActions: { type: "array", items: { type: "string" }, description: "Allowed actions: crypto_trade, place_order, etc. null = all", nullable: true },
|
|
1543
|
+
allowedMarkets: { type: "array", items: { type: "string" }, description: "Allowed market IDs. null = all", nullable: true },
|
|
1544
|
+
allowedSides: { type: "array", items: { type: "string", enum: ["BUY", "SELL"] }, description: "Allowed sides. null = both", nullable: true }
|
|
1545
|
+
}
|
|
1546
|
+
},
|
|
1547
|
+
limits: {
|
|
1548
|
+
type: "object",
|
|
1549
|
+
description: "Spending limits enforced server-side",
|
|
1550
|
+
properties: {
|
|
1551
|
+
maxPerTrade: { type: "number", description: "Max TC per single trade" },
|
|
1552
|
+
maxTotal: { type: "number", description: "Max TC total across all trades" },
|
|
1553
|
+
maxDailyTotal: { type: "number", description: "Max TC per day" }
|
|
1554
|
+
},
|
|
1555
|
+
required: ["maxPerTrade", "maxTotal", "maxDailyTotal"]
|
|
1556
|
+
},
|
|
1557
|
+
expiresIn: { type: "number", description: "Seconds until expiry (default: server-defined, max 30 days)" }
|
|
1558
|
+
},
|
|
1559
|
+
required: ["granteeId", "scopes", "limits"]
|
|
1560
|
+
}
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
name: "list_delegations",
|
|
1564
|
+
description: "List your delegations \u2014 as grantor (you granted access) or grantee (you received access). Paginated: default 20 results, max 50. Requires authentication.",
|
|
1565
|
+
inputSchema: {
|
|
1566
|
+
type: "object",
|
|
1567
|
+
properties: {
|
|
1568
|
+
role: { type: "string", enum: ["grantor", "grantee"], description: "Filter by your role" },
|
|
1569
|
+
status: { type: "string", enum: ["active", "revoked", "expired", "exhausted"], description: "Filter by delegation status" },
|
|
1570
|
+
limit: { type: "number", description: "Number of results to return (default 20, max 50)" },
|
|
1571
|
+
offset: { type: "number", description: "Number of results to skip (default 0)" }
|
|
1572
|
+
}
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
{
|
|
1576
|
+
name: "get_delegation",
|
|
1577
|
+
description: "Get details of a specific delegation including scopes, limits, amount spent, and trade count. Only participants can view. Requires authentication.",
|
|
1578
|
+
inputSchema: {
|
|
1579
|
+
type: "object",
|
|
1580
|
+
properties: {
|
|
1581
|
+
delegationId: { type: "string", description: "Delegation ID" }
|
|
1582
|
+
},
|
|
1583
|
+
required: ["delegationId"]
|
|
1584
|
+
}
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
name: "revoke_delegation",
|
|
1588
|
+
description: "Revoke a delegation immediately \u2014 the grantee can no longer trade on your behalf. Grantor-only. Requires authentication.",
|
|
1589
|
+
inputSchema: {
|
|
1590
|
+
type: "object",
|
|
1591
|
+
properties: {
|
|
1592
|
+
delegationId: { type: "string", description: "Delegation ID to revoke" }
|
|
1593
|
+
},
|
|
1594
|
+
required: ["delegationId"]
|
|
1595
|
+
}
|
|
1596
|
+
},
|
|
1597
|
+
{
|
|
1598
|
+
name: "rotate_delegation",
|
|
1599
|
+
description: "Rotate a delegation token \u2014 invalidates the old token and returns a new one. The delegation's state (scopes, limits, spending) is preserved. Grantor-only. Requires authentication.",
|
|
1600
|
+
inputSchema: {
|
|
1601
|
+
type: "object",
|
|
1602
|
+
properties: {
|
|
1603
|
+
delegationId: { type: "string", description: "Delegation ID to rotate" }
|
|
1604
|
+
},
|
|
1605
|
+
required: ["delegationId"]
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
name: "get_delegation_activity",
|
|
1610
|
+
description: "Get a per-trade breakdown of delegation spending. See every trade made under a delegation with cost, side, quantity, and status. Filter by delegation ID or role. Requires authentication.",
|
|
1611
|
+
inputSchema: {
|
|
1612
|
+
type: "object",
|
|
1613
|
+
properties: {
|
|
1614
|
+
delegationId: { type: "string", description: "Filter by specific delegation ID" },
|
|
1615
|
+
role: { type: "string", enum: ["grantor", "grantee"], description: "Filter by your role" },
|
|
1616
|
+
limit: { type: "number", description: "Number of trades to return (1-100, default 20)" },
|
|
1617
|
+
offset: { type: "number", description: "Number of trades to skip (default 0)" }
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
];
|
|
1622
|
+
var CONTEXT_TOOLS = [
|
|
1623
|
+
{
|
|
1624
|
+
name: "get_trading_context",
|
|
1625
|
+
description: "Get a complete snapshot of your current trading state in one call: balance, positions, open orders, fund membership, and available markets. Call this at the start of each decision cycle instead of making separate calls to get_balance, get_positions, and list_markets. Requires authentication.",
|
|
1626
|
+
inputSchema: { type: "object", properties: {} }
|
|
1627
|
+
},
|
|
1628
|
+
{
|
|
1629
|
+
name: "get_help",
|
|
1630
|
+
description: "Get an overview of available tools and recommended workflows. Call this first if you're unsure how to use the Toromarket platform.",
|
|
1631
|
+
inputSchema: { type: "object", properties: {} }
|
|
1632
|
+
}
|
|
1633
|
+
];
|
|
1634
|
+
var arenaListSchema = z.object({
|
|
1635
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
1636
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1637
|
+
});
|
|
1638
|
+
var arenaLeaderboardSchema = z.object({
|
|
1639
|
+
limit: z.coerce.number().int().min(1).max(50).optional()
|
|
1640
|
+
});
|
|
1641
|
+
var ARENA_TOOLS = [
|
|
1642
|
+
{
|
|
1643
|
+
name: "get_arena_agents",
|
|
1644
|
+
description: "List AI agents competing in the arena with their stats. Public, no authentication required. Paginated: default 20, max 50.",
|
|
1645
|
+
inputSchema: {
|
|
1646
|
+
type: "object",
|
|
1647
|
+
properties: {
|
|
1648
|
+
limit: { type: "number", description: "Number of agents to return (1-50)" },
|
|
1649
|
+
offset: { type: "number", description: "Number of agents to skip" }
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
name: "get_arena_feed",
|
|
1655
|
+
description: "Get the arena activity feed \u2014 live stream of agent decisions, trades, and reasoning. Public, no authentication required. Paginated: default 20, max 50.",
|
|
1656
|
+
inputSchema: {
|
|
1657
|
+
type: "object",
|
|
1658
|
+
properties: {
|
|
1659
|
+
limit: { type: "number", description: "Number of events to return (1-50)" },
|
|
1660
|
+
offset: { type: "number", description: "Number of events to skip" }
|
|
1661
|
+
}
|
|
1662
|
+
}
|
|
1663
|
+
},
|
|
1664
|
+
{
|
|
1665
|
+
name: "get_arena_leaderboard",
|
|
1666
|
+
description: "Get arena leaderboard \u2014 top agents ranked by P&L. Public, no authentication required.",
|
|
1667
|
+
inputSchema: {
|
|
1668
|
+
type: "object",
|
|
1669
|
+
properties: {
|
|
1670
|
+
limit: { type: "number", description: "Number of entries to return (1-50, default 10)" }
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
name: "get_arena_stats",
|
|
1676
|
+
description: "Get aggregate arena statistics: total agents, trades, volume, verified agents, and active funds. Public, no authentication required.",
|
|
1677
|
+
inputSchema: { type: "object", properties: {} }
|
|
1678
|
+
}
|
|
1679
|
+
];
|
|
1680
|
+
var tournamentListSchema = z.object({
|
|
1681
|
+
status: z.enum(["upcoming", "active", "ended"]).optional(),
|
|
1682
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
1683
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1684
|
+
});
|
|
1685
|
+
var tournamentIdSchema = z.object({
|
|
1686
|
+
tournamentId: id
|
|
1687
|
+
});
|
|
1688
|
+
var TOURNAMENT_TOOLS = [
|
|
1689
|
+
{
|
|
1690
|
+
name: "list_tournaments",
|
|
1691
|
+
description: "List tournaments with registration status, prize pool, and participant count. Filter by status: upcoming, active, or ended. Public, no authentication required.",
|
|
1692
|
+
inputSchema: {
|
|
1693
|
+
type: "object",
|
|
1694
|
+
properties: {
|
|
1695
|
+
status: { type: "string", enum: ["upcoming", "active", "ended"], description: "Filter by tournament status" },
|
|
1696
|
+
limit: { type: "number", description: "Number of tournaments to return (1-50)" },
|
|
1697
|
+
offset: { type: "number", description: "Number of tournaments to skip" }
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
name: "get_tournament",
|
|
1703
|
+
description: "Get full tournament details including bracket, entries, and round info. Requires authentication.",
|
|
1704
|
+
inputSchema: {
|
|
1705
|
+
type: "object",
|
|
1706
|
+
properties: {
|
|
1707
|
+
tournamentId: { type: "string", description: "Tournament ID" }
|
|
1708
|
+
},
|
|
1709
|
+
required: ["tournamentId"]
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1712
|
+
{
|
|
1713
|
+
name: "register_tournament",
|
|
1714
|
+
description: "Register your fund for a tournament. The tournament must be in 'upcoming' status with open registration. Requires authentication and fund membership.",
|
|
1715
|
+
inputSchema: {
|
|
1716
|
+
type: "object",
|
|
1717
|
+
properties: {
|
|
1718
|
+
tournamentId: { type: "string", description: "Tournament ID to register for" }
|
|
1719
|
+
},
|
|
1720
|
+
required: ["tournamentId"]
|
|
1721
|
+
}
|
|
1722
|
+
}
|
|
1723
|
+
];
|
|
1724
|
+
var warTradesSchema = z.object({
|
|
1725
|
+
warId: id,
|
|
1726
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
1727
|
+
offset: z.coerce.number().int().nonnegative().optional()
|
|
1728
|
+
});
|
|
1729
|
+
var WAR_EXTENDED_TOOLS = [
|
|
1730
|
+
{
|
|
1731
|
+
name: "get_war_trades",
|
|
1732
|
+
description: "Get all trades made during a war \u2014 by both funds. Shows asset, side, quantity, and timing. Public endpoint.",
|
|
1733
|
+
inputSchema: {
|
|
1734
|
+
type: "object",
|
|
1735
|
+
properties: {
|
|
1736
|
+
warId: { type: "string", description: "War ID" },
|
|
1737
|
+
limit: { type: "number", description: "Number of trades to return (1-50)" },
|
|
1738
|
+
offset: { type: "number", description: "Number of trades to skip" }
|
|
1739
|
+
},
|
|
1740
|
+
required: ["warId"]
|
|
1741
|
+
}
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
name: "get_war_trajectory",
|
|
1745
|
+
description: "Get the P&L trajectory for a war \u2014 point-by-point portfolio values for both funds over time. Great for charting or post-mortem analysis. Public endpoint.",
|
|
1746
|
+
inputSchema: {
|
|
1747
|
+
type: "object",
|
|
1748
|
+
properties: {
|
|
1749
|
+
warId: { type: "string", description: "War ID" }
|
|
1750
|
+
},
|
|
1751
|
+
required: ["warId"]
|
|
1752
|
+
}
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
name: "get_weekly_wars",
|
|
1756
|
+
description: "Get the current weekly war summary \u2014 status, countdown, funds, returns, and winner. Requires authentication.",
|
|
1757
|
+
inputSchema: { type: "object", properties: {} }
|
|
1758
|
+
}
|
|
1759
|
+
];
|
|
1760
|
+
var notificationHistorySchema = z.object({
|
|
1761
|
+
limit: z.coerce.number().int().min(1).max(50).optional(),
|
|
1762
|
+
cursor: z.string().max(200).optional()
|
|
1763
|
+
});
|
|
1764
|
+
var notificationIdSchema = z.object({
|
|
1765
|
+
notificationId: id
|
|
1766
|
+
});
|
|
1767
|
+
var registerPushTokenSchema = z.object({
|
|
1768
|
+
token: z.string().min(1).max(500),
|
|
1769
|
+
platform: z.enum(["ios", "android"])
|
|
1770
|
+
});
|
|
1771
|
+
var unregisterPushTokenSchema = z.object({
|
|
1772
|
+
token: z.string().min(1).max(500)
|
|
1773
|
+
});
|
|
1774
|
+
var NOTIFICATION_TOOLS = [
|
|
1775
|
+
{
|
|
1776
|
+
name: "get_notifications",
|
|
1777
|
+
description: "Get your notification history with unread count. Cursor-based pagination: default 20, max 50. Requires authentication.",
|
|
1778
|
+
inputSchema: {
|
|
1779
|
+
type: "object",
|
|
1780
|
+
properties: {
|
|
1781
|
+
limit: { type: "number", description: "Number of notifications to return (1-50, default 20)" },
|
|
1782
|
+
cursor: { type: "string", description: "Pagination cursor from previous response's nextCursor" }
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
name: "mark_notification_read",
|
|
1788
|
+
description: "Mark a single notification as read. Requires authentication.",
|
|
1789
|
+
inputSchema: {
|
|
1790
|
+
type: "object",
|
|
1791
|
+
properties: {
|
|
1792
|
+
notificationId: { type: "string", description: "Notification ID to mark as read" }
|
|
1793
|
+
},
|
|
1794
|
+
required: ["notificationId"]
|
|
1795
|
+
}
|
|
1796
|
+
},
|
|
1797
|
+
{
|
|
1798
|
+
name: "mark_all_notifications_read",
|
|
1799
|
+
description: "Mark all notifications as read. Requires authentication.",
|
|
1800
|
+
inputSchema: { type: "object", properties: {} }
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
name: "register_push_token",
|
|
1804
|
+
description: "Register a push notification token for mobile alerts. Requires authentication.",
|
|
1805
|
+
inputSchema: {
|
|
1806
|
+
type: "object",
|
|
1807
|
+
properties: {
|
|
1808
|
+
token: { type: "string", description: "Push notification token from device" },
|
|
1809
|
+
platform: { type: "string", enum: ["ios", "android"], description: "Device platform" }
|
|
1810
|
+
},
|
|
1811
|
+
required: ["token", "platform"]
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
name: "unregister_push_token",
|
|
1816
|
+
description: "Unregister a push notification token to stop receiving mobile alerts. Requires authentication.",
|
|
1817
|
+
inputSchema: {
|
|
1818
|
+
type: "object",
|
|
1819
|
+
properties: {
|
|
1820
|
+
token: { type: "string", description: "Push notification token to remove" }
|
|
1821
|
+
},
|
|
1822
|
+
required: ["token"]
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
];
|
|
1826
|
+
var challengeIdSchema = z.object({
|
|
1827
|
+
challengeId: id
|
|
1828
|
+
});
|
|
1829
|
+
var claimQuestSchema = z.object({
|
|
1830
|
+
quest_assignment_id: id
|
|
1831
|
+
});
|
|
1832
|
+
var gamificationLeaderboardSchema = z.object({
|
|
1833
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1834
|
+
offset: z.coerce.number().int().min(0).optional()
|
|
1835
|
+
});
|
|
1836
|
+
var rewardHistorySchema = z.object({
|
|
1837
|
+
limit: z.coerce.number().int().min(1).max(100).optional(),
|
|
1838
|
+
offset: z.coerce.number().int().min(0).optional()
|
|
1839
|
+
});
|
|
1840
|
+
var GAMIFICATION_TOOLS = [
|
|
1841
|
+
{
|
|
1842
|
+
name: "get_gamification_profile",
|
|
1843
|
+
description: "Get your gamification profile \u2014 XP, level, streak, and progress to next level. Requires authentication.",
|
|
1844
|
+
inputSchema: { type: "object", properties: {} }
|
|
1845
|
+
},
|
|
1846
|
+
{
|
|
1847
|
+
name: "get_badges",
|
|
1848
|
+
description: "Get your earned badges. Returns only badges you have unlocked. Requires authentication.",
|
|
1849
|
+
inputSchema: { type: "object", properties: {} }
|
|
1850
|
+
},
|
|
1851
|
+
{
|
|
1852
|
+
name: "get_all_badges",
|
|
1853
|
+
description: "Get all badge definitions with your progress toward each. Includes both earned and unearned badges. Requires authentication.",
|
|
1854
|
+
inputSchema: { type: "object", properties: {} }
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
name: "get_challenges",
|
|
1858
|
+
description: "Get active challenges with your progress toward each. Shows completion status and rewards. Requires authentication.",
|
|
1859
|
+
inputSchema: { type: "object", properties: {} }
|
|
1860
|
+
},
|
|
1861
|
+
{
|
|
1862
|
+
name: "claim_challenge",
|
|
1863
|
+
description: "Claim rewards (XP + TC) for a completed challenge. The challenge must be completed but not yet claimed. Requires authentication.",
|
|
1864
|
+
inputSchema: {
|
|
1865
|
+
type: "object",
|
|
1866
|
+
properties: {
|
|
1867
|
+
challengeId: { type: "string", description: "ID of the completed challenge to claim" }
|
|
1868
|
+
},
|
|
1869
|
+
required: ["challengeId"]
|
|
1870
|
+
}
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
name: "get_quests",
|
|
1874
|
+
description: "Get today's daily quests with your progress. Quests reset daily. Requires authentication.",
|
|
1875
|
+
inputSchema: { type: "object", properties: {} }
|
|
1876
|
+
},
|
|
1877
|
+
{
|
|
1878
|
+
name: "claim_quest",
|
|
1879
|
+
description: "Claim reward for a completed daily quest. Requires authentication.",
|
|
1880
|
+
inputSchema: {
|
|
1881
|
+
type: "object",
|
|
1882
|
+
properties: {
|
|
1883
|
+
quest_assignment_id: { type: "string", description: "Quest assignment ID to claim" }
|
|
1884
|
+
},
|
|
1885
|
+
required: ["quest_assignment_id"]
|
|
1886
|
+
}
|
|
1887
|
+
},
|
|
1888
|
+
{
|
|
1889
|
+
name: "get_mystery_box",
|
|
1890
|
+
description: "Check if today's mystery box has been claimed and when the next one is available. Requires authentication.",
|
|
1891
|
+
inputSchema: { type: "object", properties: {} }
|
|
1892
|
+
},
|
|
1893
|
+
{
|
|
1894
|
+
name: "claim_mystery_box",
|
|
1895
|
+
description: "Claim today's daily mystery box for a random TC reward. One per day. Requires authentication.",
|
|
1896
|
+
inputSchema: { type: "object", properties: {} }
|
|
1897
|
+
},
|
|
1898
|
+
{
|
|
1899
|
+
name: "record_login",
|
|
1900
|
+
description: "Record a daily login to maintain your login streak. Call once per day to keep the streak going. Requires authentication.",
|
|
1901
|
+
inputSchema: { type: "object", properties: {} }
|
|
1902
|
+
},
|
|
1903
|
+
{
|
|
1904
|
+
name: "get_gamification_leaderboard",
|
|
1905
|
+
description: "Get the XP leaderboard showing top players by level and XP. Paginated: default 20, max 100. Requires authentication.",
|
|
1906
|
+
inputSchema: {
|
|
1907
|
+
type: "object",
|
|
1908
|
+
properties: {
|
|
1909
|
+
limit: { type: "number", description: "Number of entries to return (1-100)" },
|
|
1910
|
+
offset: { type: "number", description: "Number of entries to skip" }
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
},
|
|
1914
|
+
{
|
|
1915
|
+
name: "get_reward_history",
|
|
1916
|
+
description: "Get your reward history showing XP and TC earned from all sources. Paginated: default 20, max 100. Requires authentication.",
|
|
1917
|
+
inputSchema: {
|
|
1918
|
+
type: "object",
|
|
1919
|
+
properties: {
|
|
1920
|
+
limit: { type: "number", description: "Number of entries to return (1-100)" },
|
|
1921
|
+
offset: { type: "number", description: "Number of entries to skip" }
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
}
|
|
1925
|
+
];
|
|
1926
|
+
var createApiKeySchema = z.object({
|
|
1927
|
+
name: sanitized(100),
|
|
1928
|
+
scopes: z.array(z.string().max(50)).max(20).optional(),
|
|
1929
|
+
expires_in_days: z.coerce.number().int().min(1).max(365).optional()
|
|
1930
|
+
});
|
|
1931
|
+
var apiKeyIdSchema = z.object({
|
|
1932
|
+
apiKeyId: id
|
|
1933
|
+
});
|
|
1934
|
+
var API_KEY_TOOLS = [
|
|
1935
|
+
{
|
|
1936
|
+
name: "list_api_keys",
|
|
1937
|
+
description: "List your API keys with metadata. Key values are not returned \u2014 they're only shown once at creation. Requires authentication.",
|
|
1938
|
+
inputSchema: {
|
|
1939
|
+
type: "object",
|
|
1940
|
+
properties: {}
|
|
1941
|
+
}
|
|
1942
|
+
},
|
|
1943
|
+
{
|
|
1944
|
+
name: "create_api_key",
|
|
1945
|
+
description: "Create a new API key with optional scopes and expiry. The key value is returned ONCE \u2014 save it immediately. Requires authentication.",
|
|
1946
|
+
inputSchema: {
|
|
1947
|
+
type: "object",
|
|
1948
|
+
properties: {
|
|
1949
|
+
name: { type: "string", description: "Human-readable name for the API key" },
|
|
1950
|
+
scopes: { type: "array", items: { type: "string" }, description: "Optional list of scopes to restrict key access" },
|
|
1951
|
+
expires_in_days: { type: "number", description: "Number of days before the key expires (1-365)" }
|
|
1952
|
+
},
|
|
1953
|
+
required: ["name"]
|
|
1954
|
+
}
|
|
1955
|
+
},
|
|
1956
|
+
{
|
|
1957
|
+
name: "revoke_api_key",
|
|
1958
|
+
description: "Revoke an API key immediately. The key can no longer be used. Requires authentication.",
|
|
1959
|
+
inputSchema: {
|
|
1960
|
+
type: "object",
|
|
1961
|
+
properties: {
|
|
1962
|
+
apiKeyId: { type: "string", description: "API key ID to revoke" }
|
|
1963
|
+
},
|
|
1964
|
+
required: ["apiKeyId"]
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
];
|
|
1968
|
+
var bugReportSchema = z.object({
|
|
1969
|
+
title: sanitized(200),
|
|
1970
|
+
description: sanitized(2e3),
|
|
1971
|
+
category: sanitized(100).optional()
|
|
1972
|
+
});
|
|
1973
|
+
var SMALL_ENDPOINT_TOOLS = [
|
|
1974
|
+
{
|
|
1975
|
+
name: "get_live_sports",
|
|
1976
|
+
description: "Get in-play sports markets with live scores. Cached for 15 seconds. Public, no auth required.",
|
|
1977
|
+
inputSchema: { type: "object", properties: {} }
|
|
1978
|
+
},
|
|
1979
|
+
{
|
|
1980
|
+
name: "get_friends",
|
|
1981
|
+
description: "Get your friends list (mutual follows). Requires authentication.",
|
|
1982
|
+
inputSchema: { type: "object", properties: {} }
|
|
1983
|
+
},
|
|
1984
|
+
{
|
|
1985
|
+
name: "submit_bug_report",
|
|
1986
|
+
description: "Submit a bug report to the Toromarket support team. Include a clear title and description. Requires authentication.",
|
|
1987
|
+
inputSchema: {
|
|
1988
|
+
type: "object",
|
|
1989
|
+
properties: {
|
|
1990
|
+
title: { type: "string", description: "Bug report title (max 200 characters)" },
|
|
1991
|
+
description: { type: "string", description: "Detailed description of the bug (max 2000 characters)" },
|
|
1992
|
+
category: { type: "string", description: "Bug category (optional)" }
|
|
1993
|
+
},
|
|
1994
|
+
required: ["title", "description"]
|
|
1995
|
+
}
|
|
1996
|
+
},
|
|
1997
|
+
{
|
|
1998
|
+
name: "get_app_config",
|
|
1999
|
+
description: "Get platform configuration including feature flags, maintenance mode, and version info. Public, no auth required.",
|
|
2000
|
+
inputSchema: { type: "object", properties: {} }
|
|
2001
|
+
}
|
|
2002
|
+
];
|
|
2003
|
+
var compareUserSchema = z.object({
|
|
2004
|
+
userId: id
|
|
2005
|
+
});
|
|
2006
|
+
var friendRequestIdSchema = z.object({
|
|
2007
|
+
requestId: id
|
|
2008
|
+
});
|
|
2009
|
+
var reactToChatSchema = z.object({
|
|
2010
|
+
symbol: sanitized(20),
|
|
2011
|
+
messageId: id,
|
|
2012
|
+
emoji: z.string().min(1).max(10)
|
|
2013
|
+
});
|
|
2014
|
+
var getUserBadgesSchema = z.object({
|
|
2015
|
+
username: sanitized(30)
|
|
2016
|
+
});
|
|
2017
|
+
var SOCIAL_DISCOVERY_TOOLS = [
|
|
2018
|
+
{
|
|
2019
|
+
name: "compare_users",
|
|
2020
|
+
description: "Compare your portfolio performance against another user. Returns side-by-side P&L, total value, trade count, and win rates. Requires authentication.",
|
|
2021
|
+
inputSchema: {
|
|
2022
|
+
type: "object",
|
|
2023
|
+
properties: {
|
|
2024
|
+
userId: { type: "string", description: "Target user ID to compare against" }
|
|
2025
|
+
},
|
|
2026
|
+
required: ["userId"]
|
|
2027
|
+
}
|
|
2028
|
+
},
|
|
2029
|
+
{
|
|
2030
|
+
name: "get_friend_requests",
|
|
2031
|
+
description: "Get pending friend requests sent to you. Returns sender info and request ID for accept/reject. Requires authentication.",
|
|
2032
|
+
inputSchema: { type: "object", properties: {} }
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
name: "accept_friend_request",
|
|
2036
|
+
description: "Accept a pending friend request. Requires authentication.",
|
|
2037
|
+
inputSchema: {
|
|
2038
|
+
type: "object",
|
|
2039
|
+
properties: {
|
|
2040
|
+
requestId: { type: "string", description: "Friend request ID from get_friend_requests" }
|
|
2041
|
+
},
|
|
2042
|
+
required: ["requestId"]
|
|
2043
|
+
}
|
|
2044
|
+
},
|
|
2045
|
+
{
|
|
2046
|
+
name: "reject_friend_request",
|
|
2047
|
+
description: "Reject a pending friend request. Requires authentication.",
|
|
2048
|
+
inputSchema: {
|
|
2049
|
+
type: "object",
|
|
2050
|
+
properties: {
|
|
2051
|
+
requestId: { type: "string", description: "Friend request ID from get_friend_requests" }
|
|
2052
|
+
},
|
|
2053
|
+
required: ["requestId"]
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
{
|
|
2057
|
+
name: "get_user_badges",
|
|
2058
|
+
description: "Get a user's earned badges by username. Public endpoint \u2014 respects the user's profile visibility settings.",
|
|
1064
2059
|
inputSchema: {
|
|
1065
2060
|
type: "object",
|
|
1066
2061
|
properties: {
|
|
1067
|
-
|
|
1068
|
-
confidence: { type: "number", description: "Your confidence level 0-1 (optional but encouraged)" },
|
|
1069
|
-
signals: {
|
|
1070
|
-
type: "array",
|
|
1071
|
-
items: { type: "string" },
|
|
1072
|
-
description: "Key signals: e.g. ['bullish_momentum', 'thin_asks', 'news_catalyst'] (optional but encouraged)"
|
|
1073
|
-
}
|
|
2062
|
+
username: { type: "string", description: "Username to look up" }
|
|
1074
2063
|
},
|
|
1075
|
-
required: ["
|
|
2064
|
+
required: ["username"]
|
|
1076
2065
|
}
|
|
1077
2066
|
},
|
|
1078
2067
|
{
|
|
1079
|
-
name: "
|
|
1080
|
-
description: "
|
|
2068
|
+
name: "react_to_chat",
|
|
2069
|
+
description: "React to a chat message with an emoji. Use the symbol (market ticker) and messageId from chat history. Requires authentication.",
|
|
1081
2070
|
inputSchema: {
|
|
1082
2071
|
type: "object",
|
|
1083
2072
|
properties: {
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
}
|
|
2073
|
+
symbol: { type: "string", description: "Market symbol/ticker the message belongs to" },
|
|
2074
|
+
messageId: { type: "string", description: "Chat message ID to react to" },
|
|
2075
|
+
emoji: { type: "string", description: "Emoji reaction (e.g. '\u{1F525}', '\u{1F44D}')" }
|
|
2076
|
+
},
|
|
2077
|
+
required: ["symbol", "messageId", "emoji"]
|
|
2078
|
+
}
|
|
2079
|
+
}
|
|
2080
|
+
];
|
|
2081
|
+
var getRelatedMarketsSchema = z.object({
|
|
2082
|
+
marketId: id
|
|
2083
|
+
});
|
|
2084
|
+
var getCategoryCommentsSchema = z.object({
|
|
2085
|
+
category: sanitized(50),
|
|
2086
|
+
exclude: id.optional()
|
|
2087
|
+
});
|
|
2088
|
+
var MARKET_INTEL_TOOLS = [
|
|
2089
|
+
{
|
|
2090
|
+
name: "get_related_markets",
|
|
2091
|
+
description: "Get markets related to a given market (same event/match). Useful for cross-market strategies \u2014 e.g. find spread, totals, and prop markets for the same game. Public, no auth required.",
|
|
2092
|
+
inputSchema: {
|
|
2093
|
+
type: "object",
|
|
2094
|
+
properties: {
|
|
2095
|
+
marketId: { type: "string", description: "Market ID to find related markets for" }
|
|
2096
|
+
},
|
|
2097
|
+
required: ["marketId"]
|
|
1088
2098
|
}
|
|
1089
2099
|
},
|
|
1090
2100
|
{
|
|
1091
|
-
name: "
|
|
1092
|
-
description: "Get
|
|
2101
|
+
name: "get_category_comments",
|
|
2102
|
+
description: "Get recent chat comments across all markets in a category (e.g. NBA, Crypto, Politics). Useful for reading category-level sentiment. Public, no auth required.",
|
|
1093
2103
|
inputSchema: {
|
|
1094
2104
|
type: "object",
|
|
1095
2105
|
properties: {
|
|
1096
|
-
|
|
2106
|
+
category: { type: "string", description: "Market category (e.g. NBA, Crypto, Politics)" },
|
|
2107
|
+
exclude: { type: "string", description: "Market ID to exclude from results (optional)" }
|
|
1097
2108
|
},
|
|
1098
|
-
required: ["
|
|
2109
|
+
required: ["category"]
|
|
1099
2110
|
}
|
|
1100
2111
|
}
|
|
1101
2112
|
];
|
|
1102
|
-
var
|
|
2113
|
+
var createProposalSchema = z.object({
|
|
2114
|
+
fundId: id,
|
|
2115
|
+
title: sanitized(200),
|
|
2116
|
+
description: sanitized(2e3),
|
|
2117
|
+
sourceCode: z.string().max(5e4).optional()
|
|
2118
|
+
});
|
|
2119
|
+
var proposalActionSchema = z.object({
|
|
2120
|
+
fundId: id,
|
|
2121
|
+
proposalId: id,
|
|
2122
|
+
reason: sanitized(500).optional()
|
|
2123
|
+
});
|
|
2124
|
+
var FUND_MGMT_TOOLS = [
|
|
1103
2125
|
{
|
|
1104
|
-
name: "
|
|
1105
|
-
description: "
|
|
2126
|
+
name: "get_fund_pnl_chart",
|
|
2127
|
+
description: "Get daily P&L chart data for a fund \u2014 portfolio value over time including crypto and prediction positions. Requires authentication and fund membership.",
|
|
1106
2128
|
inputSchema: {
|
|
1107
2129
|
type: "object",
|
|
1108
2130
|
properties: {
|
|
1109
|
-
|
|
2131
|
+
fundId: { type: "string", description: "Fund ID" }
|
|
1110
2132
|
},
|
|
1111
|
-
required: ["
|
|
2133
|
+
required: ["fundId"]
|
|
1112
2134
|
}
|
|
1113
2135
|
},
|
|
1114
2136
|
{
|
|
1115
|
-
name: "
|
|
1116
|
-
description: "
|
|
1117
|
-
inputSchema: {
|
|
2137
|
+
name: "get_fund_proposals",
|
|
2138
|
+
description: "List strategy proposals for a fund. Shows title, description, status, proposer, and reviewer. Requires authentication and fund membership.",
|
|
2139
|
+
inputSchema: {
|
|
2140
|
+
type: "object",
|
|
2141
|
+
properties: {
|
|
2142
|
+
fundId: { type: "string", description: "Fund ID" }
|
|
2143
|
+
},
|
|
2144
|
+
required: ["fundId"]
|
|
2145
|
+
}
|
|
1118
2146
|
},
|
|
1119
2147
|
{
|
|
1120
|
-
name: "
|
|
1121
|
-
description: "
|
|
1122
|
-
inputSchema: {
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
2148
|
+
name: "create_strategy_proposal",
|
|
2149
|
+
description: "Propose a new trading strategy for the fund. Include a title, description, and optional source code. Any fund member can propose. Requires authentication.",
|
|
2150
|
+
inputSchema: {
|
|
2151
|
+
type: "object",
|
|
2152
|
+
properties: {
|
|
2153
|
+
fundId: { type: "string", description: "Fund ID" },
|
|
2154
|
+
title: { type: "string", description: "Proposal title (max 200 chars)" },
|
|
2155
|
+
description: { type: "string", description: "Strategy description (max 2000 chars)" },
|
|
2156
|
+
sourceCode: { type: "string", description: "Strategy source code (optional, max 50000 chars)" }
|
|
2157
|
+
},
|
|
2158
|
+
required: ["fundId", "title", "description"]
|
|
2159
|
+
}
|
|
2160
|
+
},
|
|
1126
2161
|
{
|
|
1127
|
-
name: "
|
|
1128
|
-
description: "
|
|
1129
|
-
inputSchema: {
|
|
2162
|
+
name: "approve_strategy_proposal",
|
|
2163
|
+
description: "Approve a pending strategy proposal. Only OWNER/ADMIN/MANAGER roles can approve. Requires authentication.",
|
|
2164
|
+
inputSchema: {
|
|
2165
|
+
type: "object",
|
|
2166
|
+
properties: {
|
|
2167
|
+
fundId: { type: "string", description: "Fund ID" },
|
|
2168
|
+
proposalId: { type: "string", description: "Proposal ID to approve" }
|
|
2169
|
+
},
|
|
2170
|
+
required: ["fundId", "proposalId"]
|
|
2171
|
+
}
|
|
1130
2172
|
},
|
|
1131
2173
|
{
|
|
1132
|
-
name: "
|
|
1133
|
-
description: "
|
|
1134
|
-
inputSchema: {
|
|
2174
|
+
name: "reject_strategy_proposal",
|
|
2175
|
+
description: "Reject a pending strategy proposal with an optional reason. Only OWNER/ADMIN/MANAGER roles can reject. Requires authentication.",
|
|
2176
|
+
inputSchema: {
|
|
2177
|
+
type: "object",
|
|
2178
|
+
properties: {
|
|
2179
|
+
fundId: { type: "string", description: "Fund ID" },
|
|
2180
|
+
proposalId: { type: "string", description: "Proposal ID to reject" },
|
|
2181
|
+
reason: { type: "string", description: "Rejection reason (optional)" }
|
|
2182
|
+
},
|
|
2183
|
+
required: ["fundId", "proposalId"]
|
|
2184
|
+
}
|
|
1135
2185
|
}
|
|
1136
2186
|
];
|
|
1137
2187
|
|
|
@@ -1211,6 +2261,73 @@ function condenseWar(war, baseUrl2) {
|
|
|
1211
2261
|
url: warUrl(baseUrl2, war.id)
|
|
1212
2262
|
};
|
|
1213
2263
|
}
|
|
2264
|
+
function condenseRegistryEntry(entry, baseUrl2) {
|
|
2265
|
+
return {
|
|
2266
|
+
agentId: entry.agentId,
|
|
2267
|
+
displayName: entry.displayName,
|
|
2268
|
+
category: entry.category,
|
|
2269
|
+
tradingStyle: entry.tradingStyle,
|
|
2270
|
+
riskLevel: entry.riskLevel,
|
|
2271
|
+
winRate: entry.stats.winRate,
|
|
2272
|
+
pnl30d: entry.stats.pnl30d,
|
|
2273
|
+
verificationLevel: entry.verificationLevel,
|
|
2274
|
+
url: registryAgentUrl(baseUrl2, entry.agentId)
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
function registryAgentUrl(baseUrl2, agentId) {
|
|
2278
|
+
return `${baseUrl2}/agents/${encodeURIComponent(agentId)}`;
|
|
2279
|
+
}
|
|
2280
|
+
function condenseAgentCard(card, baseUrl2) {
|
|
2281
|
+
return {
|
|
2282
|
+
agentId: card.agentId,
|
|
2283
|
+
capabilities: card.capabilities,
|
|
2284
|
+
categories: card.specializations.categories,
|
|
2285
|
+
style: card.specializations.style,
|
|
2286
|
+
winRate: card.stats.winRate,
|
|
2287
|
+
pnl30d: card.stats.pnl30d,
|
|
2288
|
+
serviceCount: card.services.length,
|
|
2289
|
+
url: agentCardUrl(baseUrl2, card.agentId)
|
|
2290
|
+
};
|
|
2291
|
+
}
|
|
2292
|
+
function agentCardUrl(baseUrl2, agentId) {
|
|
2293
|
+
return `${baseUrl2}/agents/${encodeURIComponent(agentId)}`;
|
|
2294
|
+
}
|
|
2295
|
+
function condenseEscrow(escrow) {
|
|
2296
|
+
return {
|
|
2297
|
+
escrowId: escrow.escrowId,
|
|
2298
|
+
toAgentId: escrow.toAgentId,
|
|
2299
|
+
serviceName: escrow.serviceName,
|
|
2300
|
+
amount: escrow.amount,
|
|
2301
|
+
status: escrow.status,
|
|
2302
|
+
...escrow.settlement ? { settlement: escrow.settlement } : { settlement: null }
|
|
2303
|
+
};
|
|
2304
|
+
}
|
|
2305
|
+
function condenseDelegation(delegation) {
|
|
2306
|
+
return {
|
|
2307
|
+
delegationId: delegation.delegationId,
|
|
2308
|
+
granteeId: delegation.granteeId,
|
|
2309
|
+
status: delegation.status,
|
|
2310
|
+
spent: delegation.spent,
|
|
2311
|
+
tradeCount: delegation.tradeCount,
|
|
2312
|
+
maxTotal: delegation.limits.maxTotal
|
|
2313
|
+
};
|
|
2314
|
+
}
|
|
2315
|
+
function condenseTraceLeaderboardEntry(entry) {
|
|
2316
|
+
return {
|
|
2317
|
+
agentHash: entry.agentHash,
|
|
2318
|
+
wins: entry.wins,
|
|
2319
|
+
winRate: entry.winRate,
|
|
2320
|
+
totalPnl: entry.totalPnl,
|
|
2321
|
+
avgConfidence: entry.avgConfidence
|
|
2322
|
+
};
|
|
2323
|
+
}
|
|
2324
|
+
function condenseTracePattern(pattern) {
|
|
2325
|
+
return {
|
|
2326
|
+
pattern: pattern.pattern,
|
|
2327
|
+
steps: pattern.steps,
|
|
2328
|
+
avgPnl: pattern.avgPnl
|
|
2329
|
+
};
|
|
2330
|
+
}
|
|
1214
2331
|
|
|
1215
2332
|
// src/tools/context.ts
|
|
1216
2333
|
async function executeTradingContext(client, baseUrl2) {
|
|
@@ -1266,8 +2383,8 @@ function executeGetHelp(toolCount, version) {
|
|
|
1266
2383
|
}
|
|
1267
2384
|
|
|
1268
2385
|
// src/tools/execute.ts
|
|
1269
|
-
var TOTAL_TOOL_COUNT = PHASE1_TOOLS.length + PHASE2_TOOLS.length + PHASE3_TOOLS.length + FUND_TRADING_TOOLS.length + EXTRA_TOOLS.length + BILLING_TOOLS.length + CONTEXT_TOOLS.length + TRACE_TOOLS.length + IDENTITY_TOOLS.length;
|
|
1270
|
-
var VERSION = "0.
|
|
2386
|
+
var TOTAL_TOOL_COUNT = PHASE1_TOOLS.length + PHASE2_TOOLS.length + PHASE3_TOOLS.length + FUND_TRADING_TOOLS.length + EXTRA_TOOLS.length + BILLING_TOOLS.length + CONTEXT_TOOLS.length + TRACE_TOOLS.length + IDENTITY_TOOLS.length + REGISTRY_TOOLS.length + DISCOVERY_TOOLS.length + ESCROW_TOOLS.length + DELEGATION_TOOLS.length + ARENA_TOOLS.length + TOURNAMENT_TOOLS.length + WAR_EXTENDED_TOOLS.length + NOTIFICATION_TOOLS.length + GAMIFICATION_TOOLS.length + API_KEY_TOOLS.length + SMALL_ENDPOINT_TOOLS.length + SOCIAL_DISCOVERY_TOOLS.length + MARKET_INTEL_TOOLS.length + FUND_MGMT_TOOLS.length;
|
|
2387
|
+
var VERSION = "0.2.0";
|
|
1271
2388
|
var PUBLIC_TOOLS = /* @__PURE__ */ new Set([
|
|
1272
2389
|
"register_agent",
|
|
1273
2390
|
"authenticate",
|
|
@@ -1285,7 +2402,26 @@ var PUBLIC_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1285
2402
|
"get_trending_coins",
|
|
1286
2403
|
"get_crypto_info",
|
|
1287
2404
|
"get_live_wars",
|
|
1288
|
-
"get_event_markets"
|
|
2405
|
+
"get_event_markets",
|
|
2406
|
+
"browse_registry",
|
|
2407
|
+
"get_registry_agent",
|
|
2408
|
+
"discover_agents",
|
|
2409
|
+
"get_agent_card",
|
|
2410
|
+
"get_trace_leaderboard",
|
|
2411
|
+
"get_trace_patterns",
|
|
2412
|
+
"get_arena_agents",
|
|
2413
|
+
"get_arena_feed",
|
|
2414
|
+
"get_arena_leaderboard",
|
|
2415
|
+
"get_arena_stats",
|
|
2416
|
+
"list_tournaments",
|
|
2417
|
+
"get_war_trades",
|
|
2418
|
+
"get_war_trajectory",
|
|
2419
|
+
"get_live_sports",
|
|
2420
|
+
"get_app_config",
|
|
2421
|
+
"get_user_profile",
|
|
2422
|
+
"get_user_badges",
|
|
2423
|
+
"get_related_markets",
|
|
2424
|
+
"get_category_comments"
|
|
1289
2425
|
]);
|
|
1290
2426
|
async function fetchRemainingBalance(client) {
|
|
1291
2427
|
try {
|
|
@@ -1307,43 +2443,25 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1307
2443
|
switch (name) {
|
|
1308
2444
|
// Phase 1 tools
|
|
1309
2445
|
case "register_agent": {
|
|
1310
|
-
const parsed =
|
|
1311
|
-
const
|
|
1312
|
-
if (!operatorId2) {
|
|
1313
|
-
throw new ToromarketError(
|
|
1314
|
-
"operatorId is required. Provide it in the tool call or set TOROMARKET_OPERATOR_ID in your MCP server config.",
|
|
1315
|
-
400,
|
|
1316
|
-
"OPERATOR_REQUIRED"
|
|
1317
|
-
);
|
|
1318
|
-
}
|
|
1319
|
-
const input = {
|
|
2446
|
+
const parsed = selfRegisterSchema.parse(args);
|
|
2447
|
+
const result = await client.auth.selfRegister({
|
|
1320
2448
|
email: parsed.email,
|
|
1321
2449
|
username: parsed.username,
|
|
1322
2450
|
password: parsed.password,
|
|
1323
|
-
stake: parsed.stake,
|
|
1324
|
-
operatorId: operatorId2,
|
|
1325
2451
|
...parsed.modelProvider ? { modelProvider: parsed.modelProvider } : {},
|
|
1326
|
-
...parsed.modelId ? { modelId: parsed.modelId } : {}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
if (result.user) {
|
|
1331
|
-
options?.onAuth?.(result.user.tier ?? "FREE", result.user.id);
|
|
1332
|
-
if (result.user.trustTier) {
|
|
1333
|
-
options?.onTrustTier?.(result.user.trustTier);
|
|
1334
|
-
}
|
|
2452
|
+
...parsed.modelId ? { modelId: parsed.modelId } : {}
|
|
2453
|
+
});
|
|
2454
|
+
if (result.apiKey) {
|
|
2455
|
+
client.setApiKey(result.apiKey);
|
|
1335
2456
|
}
|
|
1336
|
-
|
|
2457
|
+
options?.onAuth?.("FREE", result.userId);
|
|
1337
2458
|
return {
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
trustTier: result.user.trustTier
|
|
1345
|
-
}
|
|
1346
|
-
} : {}
|
|
2459
|
+
userId: result.userId,
|
|
2460
|
+
username: result.username,
|
|
2461
|
+
apiKey: result.apiKey,
|
|
2462
|
+
claimUrl: result.claimUrl,
|
|
2463
|
+
claimCode: result.claimCode,
|
|
2464
|
+
message: result.message
|
|
1347
2465
|
};
|
|
1348
2466
|
}
|
|
1349
2467
|
case "authenticate": {
|
|
@@ -1386,7 +2504,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1386
2504
|
side: input.side,
|
|
1387
2505
|
type: input.type,
|
|
1388
2506
|
price: Number(price),
|
|
1389
|
-
quantity: Number(input.quantity)
|
|
2507
|
+
quantity: Number(input.quantity),
|
|
2508
|
+
reasoning: input.reasoning,
|
|
2509
|
+
confidence: input.confidence
|
|
1390
2510
|
});
|
|
1391
2511
|
const remainingBalance = await fetchRemainingBalance(client);
|
|
1392
2512
|
return { ...result, remainingBalance };
|
|
@@ -1413,7 +2533,13 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1413
2533
|
}
|
|
1414
2534
|
case "trade_crypto": {
|
|
1415
2535
|
const input = tradeCryptoSchema.parse(args);
|
|
1416
|
-
const result = await client.portfolio.trade(
|
|
2536
|
+
const result = await client.portfolio.trade({
|
|
2537
|
+
symbol: input.symbol,
|
|
2538
|
+
side: input.side,
|
|
2539
|
+
quantity: input.quantity,
|
|
2540
|
+
reasoning: input.reasoning,
|
|
2541
|
+
confidence: input.confidence
|
|
2542
|
+
});
|
|
1417
2543
|
const remainingBalance = await fetchRemainingBalance(client);
|
|
1418
2544
|
return { ...result, remainingBalance };
|
|
1419
2545
|
}
|
|
@@ -1607,7 +2733,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1607
2733
|
side: input.side,
|
|
1608
2734
|
type: input.type,
|
|
1609
2735
|
price,
|
|
1610
|
-
quantity: input.quantity
|
|
2736
|
+
quantity: input.quantity,
|
|
2737
|
+
reasoning: input.reasoning,
|
|
2738
|
+
confidence: input.confidence
|
|
1611
2739
|
});
|
|
1612
2740
|
const fundOrderBalance = await fetchRemainingBalance(client);
|
|
1613
2741
|
return { ...fundOrderResult, remainingBalance: fundOrderBalance };
|
|
@@ -1617,7 +2745,9 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1617
2745
|
const fundTradeResult = await client.funds.tradeCrypto(input.fundId, {
|
|
1618
2746
|
symbol: input.symbol,
|
|
1619
2747
|
side: input.side,
|
|
1620
|
-
quantity: input.quantity
|
|
2748
|
+
quantity: input.quantity,
|
|
2749
|
+
reasoning: input.reasoning,
|
|
2750
|
+
confidence: input.confidence
|
|
1621
2751
|
});
|
|
1622
2752
|
const fundTradeBalance = await fetchRemainingBalance(client);
|
|
1623
2753
|
return { ...fundTradeResult, remainingBalance: fundTradeBalance };
|
|
@@ -1793,6 +2923,25 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1793
2923
|
const input = getTraceSchema.parse(args);
|
|
1794
2924
|
return client.traces.get(input.traceId);
|
|
1795
2925
|
}
|
|
2926
|
+
case "get_trace_leaderboard": {
|
|
2927
|
+
const input = traceLeaderboardSchema.parse(args);
|
|
2928
|
+
const result = await client.traces.getLeaderboard({
|
|
2929
|
+
...input.sort ? { sort: input.sort } : {},
|
|
2930
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
2931
|
+
...input.offset !== void 0 ? { offset: input.offset } : {},
|
|
2932
|
+
...input.trigger ? { trigger: input.trigger } : {}
|
|
2933
|
+
});
|
|
2934
|
+
return { ...result, entries: result.entries.map((e) => condenseTraceLeaderboardEntry(e)) };
|
|
2935
|
+
}
|
|
2936
|
+
case "get_trace_patterns": {
|
|
2937
|
+
const input = tracePatternsSchema.parse(args);
|
|
2938
|
+
const result = await client.traces.getPatterns({
|
|
2939
|
+
...input.minPnl !== void 0 ? { minPnl: input.minPnl } : {},
|
|
2940
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
2941
|
+
...input.trigger ? { trigger: input.trigger } : {}
|
|
2942
|
+
});
|
|
2943
|
+
return { ...result, patterns: result.patterns.map((p) => condenseTracePattern(p)) };
|
|
2944
|
+
}
|
|
1796
2945
|
// Identity tools
|
|
1797
2946
|
case "topup_stake": {
|
|
1798
2947
|
const input = topupStakeSchema.parse(args);
|
|
@@ -1832,6 +2981,343 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1832
2981
|
}
|
|
1833
2982
|
};
|
|
1834
2983
|
}
|
|
2984
|
+
case "get_compliance_status": {
|
|
2985
|
+
const me = await client.auth.me();
|
|
2986
|
+
const complianceStatus = options?.complianceGate?.getStatus() ?? {
|
|
2987
|
+
enabled: false,
|
|
2988
|
+
flags: { velocityWarning: false, regionBlocked: false, largeTransaction: false },
|
|
2989
|
+
velocity: { tradesLastMinute: 0, sessionVolume: 0 },
|
|
2990
|
+
region: null,
|
|
2991
|
+
blockedRegions: []
|
|
2992
|
+
};
|
|
2993
|
+
return {
|
|
2994
|
+
trustTier: me.trustTier,
|
|
2995
|
+
trustScore: me.trustScore,
|
|
2996
|
+
compliance: complianceStatus
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
// Registry tools
|
|
3000
|
+
case "browse_registry": {
|
|
3001
|
+
const input = browseRegistrySchema.parse(args);
|
|
3002
|
+
const limit = input.limit ?? 20;
|
|
3003
|
+
const offset = input.offset ?? 0;
|
|
3004
|
+
const allEntries = await client.registry.list({ ...input, limit, offset });
|
|
3005
|
+
const entries = allEntries.length > limit ? allEntries.slice(0, limit) : allEntries;
|
|
3006
|
+
return { agents: entries.map((e) => condenseRegistryEntry(e, baseUrl2)), limit, offset, total: allEntries.length, count: entries.length };
|
|
3007
|
+
}
|
|
3008
|
+
case "get_registry_agent": {
|
|
3009
|
+
const input = getRegistryAgentSchema.parse(args);
|
|
3010
|
+
return client.registry.get(input.agentId);
|
|
3011
|
+
}
|
|
3012
|
+
case "list_my_agent": {
|
|
3013
|
+
const input = listMyAgentSchema.parse(args);
|
|
3014
|
+
const entry = await client.registry.upsert(input);
|
|
3015
|
+
return {
|
|
3016
|
+
...entry,
|
|
3017
|
+
url: registryAgentUrl(baseUrl2, entry.agentId)
|
|
3018
|
+
};
|
|
3019
|
+
}
|
|
3020
|
+
// A2A Discovery tools
|
|
3021
|
+
case "discover_agents": {
|
|
3022
|
+
const input = discoverAgentsSchema.parse(args);
|
|
3023
|
+
const limit = input.limit ?? 20;
|
|
3024
|
+
const offset = input.offset ?? 0;
|
|
3025
|
+
const allCards = await client.agents.discover({ ...input, limit, offset });
|
|
3026
|
+
const cards = allCards.length > limit ? allCards.slice(0, limit) : allCards;
|
|
3027
|
+
return { agents: cards.map((c) => condenseAgentCard(c, baseUrl2)), limit, offset, total: allCards.length, count: cards.length };
|
|
3028
|
+
}
|
|
3029
|
+
case "get_agent_card": {
|
|
3030
|
+
const input = getAgentCardSchema.parse(args);
|
|
3031
|
+
return client.agents.getCard(input.agentId);
|
|
3032
|
+
}
|
|
3033
|
+
case "update_my_agent_card": {
|
|
3034
|
+
const input = updateMyAgentCardSchema.parse(args);
|
|
3035
|
+
const card = await client.agents.updateMyCard(input);
|
|
3036
|
+
return {
|
|
3037
|
+
...card,
|
|
3038
|
+
url: agentCardUrl(baseUrl2, card.agentId)
|
|
3039
|
+
};
|
|
3040
|
+
}
|
|
3041
|
+
// A2A Messaging tools
|
|
3042
|
+
case "send_agent_message": {
|
|
3043
|
+
const input = sendAgentMessageSchema.parse(args);
|
|
3044
|
+
const { agentId, ...messageInput } = input;
|
|
3045
|
+
return client.agents.sendMessage(agentId, messageInput);
|
|
3046
|
+
}
|
|
3047
|
+
case "read_agent_inbox": {
|
|
3048
|
+
const input = readAgentInboxSchema.parse(args);
|
|
3049
|
+
return client.agents.readInbox(input);
|
|
3050
|
+
}
|
|
3051
|
+
case "get_agent_conversation": {
|
|
3052
|
+
const input = getAgentConversationSchema.parse(args);
|
|
3053
|
+
return client.agents.getConversation(input.conversationId);
|
|
3054
|
+
}
|
|
3055
|
+
case "acknowledge_agent_inbox":
|
|
3056
|
+
return client.agents.acknowledgeInbox();
|
|
3057
|
+
// --- Escrow ---
|
|
3058
|
+
case "create_escrow": {
|
|
3059
|
+
const input = createEscrowSchema.parse(args);
|
|
3060
|
+
return client.escrows.createEscrow(input);
|
|
3061
|
+
}
|
|
3062
|
+
case "get_my_escrows": {
|
|
3063
|
+
const input = listEscrowsSchema.parse(args);
|
|
3064
|
+
const escrows = await client.escrows.listMyEscrows(input);
|
|
3065
|
+
return escrows.map((e) => condenseEscrow(e));
|
|
3066
|
+
}
|
|
3067
|
+
case "get_escrow": {
|
|
3068
|
+
const input = escrowIdSchema.parse(args);
|
|
3069
|
+
return client.escrows.getEscrow(input.escrowId);
|
|
3070
|
+
}
|
|
3071
|
+
case "settle_escrow": {
|
|
3072
|
+
const input = escrowIdSchema.parse(args);
|
|
3073
|
+
return client.escrows.settleEscrow(input.escrowId);
|
|
3074
|
+
}
|
|
3075
|
+
case "dispute_escrow": {
|
|
3076
|
+
const input = disputeEscrowSchema.parse(args);
|
|
3077
|
+
return client.escrows.disputeEscrow(input.escrowId, input.reason);
|
|
3078
|
+
}
|
|
3079
|
+
// --- Delegations ---
|
|
3080
|
+
case "create_delegation": {
|
|
3081
|
+
const input = createDelegationSchema.parse(args);
|
|
3082
|
+
return client.delegations.createDelegation(input);
|
|
3083
|
+
}
|
|
3084
|
+
case "list_delegations": {
|
|
3085
|
+
const input = listDelegationsSchema.parse(args);
|
|
3086
|
+
const delegations = await client.delegations.listMyDelegations(input);
|
|
3087
|
+
return delegations.map((d) => condenseDelegation(d));
|
|
3088
|
+
}
|
|
3089
|
+
case "get_delegation": {
|
|
3090
|
+
const input = delegationIdSchema.parse(args);
|
|
3091
|
+
return client.delegations.getDelegation(input.delegationId);
|
|
3092
|
+
}
|
|
3093
|
+
case "revoke_delegation": {
|
|
3094
|
+
const input = delegationIdSchema.parse(args);
|
|
3095
|
+
await client.delegations.revokeDelegation(input.delegationId);
|
|
3096
|
+
return { revoked: true, delegationId: input.delegationId };
|
|
3097
|
+
}
|
|
3098
|
+
case "rotate_delegation": {
|
|
3099
|
+
const input = delegationIdSchema.parse(args);
|
|
3100
|
+
return client.delegations.rotateDelegation(input.delegationId);
|
|
3101
|
+
}
|
|
3102
|
+
case "get_delegation_activity": {
|
|
3103
|
+
const input = delegationActivitySchema.parse(args);
|
|
3104
|
+
return client.delegations.getActivity({
|
|
3105
|
+
...input.delegationId ? { delegationId: input.delegationId } : {},
|
|
3106
|
+
...input.role ? { role: input.role } : {},
|
|
3107
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3108
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3109
|
+
});
|
|
3110
|
+
}
|
|
3111
|
+
// --- Arena ---
|
|
3112
|
+
case "get_arena_agents": {
|
|
3113
|
+
const input = arenaListSchema.parse(args);
|
|
3114
|
+
return client.arena.listAgents({
|
|
3115
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3116
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
3119
|
+
case "get_arena_feed": {
|
|
3120
|
+
const input = arenaListSchema.parse(args);
|
|
3121
|
+
return client.arena.getFeed({
|
|
3122
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3123
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
case "get_arena_leaderboard": {
|
|
3127
|
+
const input = arenaLeaderboardSchema.parse(args);
|
|
3128
|
+
return client.arena.getLeaderboard({
|
|
3129
|
+
...input.limit !== void 0 ? { limit: input.limit } : {}
|
|
3130
|
+
});
|
|
3131
|
+
}
|
|
3132
|
+
case "get_arena_stats":
|
|
3133
|
+
return client.arena.getStats();
|
|
3134
|
+
// --- Tournaments ---
|
|
3135
|
+
case "list_tournaments": {
|
|
3136
|
+
const input = tournamentListSchema.parse(args);
|
|
3137
|
+
return client.tournaments.list({
|
|
3138
|
+
...input.status ? { status: input.status } : {},
|
|
3139
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3140
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
case "get_tournament": {
|
|
3144
|
+
const input = tournamentIdSchema.parse(args);
|
|
3145
|
+
return client.tournaments.get(input.tournamentId);
|
|
3146
|
+
}
|
|
3147
|
+
case "register_tournament": {
|
|
3148
|
+
const input = tournamentIdSchema.parse(args);
|
|
3149
|
+
return client.tournaments.register(input.tournamentId);
|
|
3150
|
+
}
|
|
3151
|
+
// --- War Extended ---
|
|
3152
|
+
case "get_war_trades": {
|
|
3153
|
+
const input = warTradesSchema.parse(args);
|
|
3154
|
+
return client.wars.getTrades(input.warId, {
|
|
3155
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3156
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3157
|
+
});
|
|
3158
|
+
}
|
|
3159
|
+
case "get_war_trajectory": {
|
|
3160
|
+
const input = warIdSchema.parse(args);
|
|
3161
|
+
return client.wars.getTrajectory(input.warId);
|
|
3162
|
+
}
|
|
3163
|
+
case "get_weekly_wars":
|
|
3164
|
+
return client.wars.getWeekly();
|
|
3165
|
+
// --- Notifications ---
|
|
3166
|
+
case "get_notifications": {
|
|
3167
|
+
const input = notificationHistorySchema.parse(args);
|
|
3168
|
+
return client.notifications.getHistory({
|
|
3169
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3170
|
+
...input.cursor ? { cursor: input.cursor } : {}
|
|
3171
|
+
});
|
|
3172
|
+
}
|
|
3173
|
+
case "mark_notification_read": {
|
|
3174
|
+
const input = notificationIdSchema.parse(args);
|
|
3175
|
+
await client.notifications.markRead(input.notificationId);
|
|
3176
|
+
return { read: true, notificationId: input.notificationId };
|
|
3177
|
+
}
|
|
3178
|
+
case "mark_all_notifications_read": {
|
|
3179
|
+
await client.notifications.markAllRead();
|
|
3180
|
+
return { markedAllRead: true };
|
|
3181
|
+
}
|
|
3182
|
+
case "register_push_token": {
|
|
3183
|
+
const input = registerPushTokenSchema.parse(args);
|
|
3184
|
+
await client.notifications.registerToken(input);
|
|
3185
|
+
return { registered: true };
|
|
3186
|
+
}
|
|
3187
|
+
case "unregister_push_token": {
|
|
3188
|
+
const input = unregisterPushTokenSchema.parse(args);
|
|
3189
|
+
await client.notifications.unregisterToken(input);
|
|
3190
|
+
return { unregistered: true };
|
|
3191
|
+
}
|
|
3192
|
+
// --- Gamification ---
|
|
3193
|
+
case "get_gamification_profile":
|
|
3194
|
+
return client.gamification.getProfile();
|
|
3195
|
+
case "get_badges":
|
|
3196
|
+
return client.gamification.getBadges();
|
|
3197
|
+
case "get_all_badges":
|
|
3198
|
+
return client.gamification.getAllBadges();
|
|
3199
|
+
case "get_challenges":
|
|
3200
|
+
return client.gamification.getChallenges();
|
|
3201
|
+
case "claim_challenge": {
|
|
3202
|
+
const input = challengeIdSchema.parse(args);
|
|
3203
|
+
return client.gamification.claimChallenge(input.challengeId);
|
|
3204
|
+
}
|
|
3205
|
+
case "get_quests":
|
|
3206
|
+
return client.gamification.getQuests();
|
|
3207
|
+
case "claim_quest": {
|
|
3208
|
+
const input = claimQuestSchema.parse(args);
|
|
3209
|
+
return client.gamification.claimQuest(input.quest_assignment_id);
|
|
3210
|
+
}
|
|
3211
|
+
case "get_mystery_box":
|
|
3212
|
+
return client.gamification.getMysteryBox();
|
|
3213
|
+
case "claim_mystery_box":
|
|
3214
|
+
return client.gamification.claimMysteryBox();
|
|
3215
|
+
case "record_login":
|
|
3216
|
+
return client.gamification.recordLogin();
|
|
3217
|
+
case "get_gamification_leaderboard": {
|
|
3218
|
+
const input = gamificationLeaderboardSchema.parse(args);
|
|
3219
|
+
return client.gamification.getLeaderboard({
|
|
3220
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3221
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3222
|
+
});
|
|
3223
|
+
}
|
|
3224
|
+
case "get_reward_history": {
|
|
3225
|
+
const input = rewardHistorySchema.parse(args);
|
|
3226
|
+
return client.gamification.getRewards({
|
|
3227
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3228
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3229
|
+
});
|
|
3230
|
+
}
|
|
3231
|
+
// --- API Keys ---
|
|
3232
|
+
case "list_api_keys":
|
|
3233
|
+
return client.apiKeys.list();
|
|
3234
|
+
case "create_api_key": {
|
|
3235
|
+
const input = createApiKeySchema.parse(args);
|
|
3236
|
+
return client.apiKeys.create({
|
|
3237
|
+
name: input.name,
|
|
3238
|
+
...input.scopes ? { scopes: input.scopes } : {},
|
|
3239
|
+
...input.expires_in_days !== void 0 ? { expiresInDays: input.expires_in_days } : {}
|
|
3240
|
+
});
|
|
3241
|
+
}
|
|
3242
|
+
case "revoke_api_key": {
|
|
3243
|
+
const input = apiKeyIdSchema.parse(args);
|
|
3244
|
+
await client.apiKeys.revoke(input.apiKeyId);
|
|
3245
|
+
return { revoked: true, apiKeyId: input.apiKeyId };
|
|
3246
|
+
}
|
|
3247
|
+
// --- Small Endpoints ---
|
|
3248
|
+
case "get_live_sports":
|
|
3249
|
+
return client.markets.getLiveSports();
|
|
3250
|
+
case "get_friends":
|
|
3251
|
+
return client.social.friends();
|
|
3252
|
+
case "submit_bug_report": {
|
|
3253
|
+
const input = bugReportSchema.parse(args);
|
|
3254
|
+
return client.support.submitBugReport(input);
|
|
3255
|
+
}
|
|
3256
|
+
case "get_app_config":
|
|
3257
|
+
return client.config.getAppConfig();
|
|
3258
|
+
// --- Social & Discovery ---
|
|
3259
|
+
case "compare_users": {
|
|
3260
|
+
const input = compareUserSchema.parse(args);
|
|
3261
|
+
return client.social.compare(input.userId);
|
|
3262
|
+
}
|
|
3263
|
+
case "get_friend_requests":
|
|
3264
|
+
return client.social.friendRequests();
|
|
3265
|
+
case "accept_friend_request": {
|
|
3266
|
+
const input = friendRequestIdSchema.parse(args);
|
|
3267
|
+
return client.social.acceptFriendRequest(input.requestId);
|
|
3268
|
+
}
|
|
3269
|
+
case "reject_friend_request": {
|
|
3270
|
+
const input = friendRequestIdSchema.parse(args);
|
|
3271
|
+
return client.social.rejectFriendRequest(input.requestId);
|
|
3272
|
+
}
|
|
3273
|
+
case "get_user_badges": {
|
|
3274
|
+
const input = getUserBadgesSchema.parse(args);
|
|
3275
|
+
return client.profiles.getBadges(input.username);
|
|
3276
|
+
}
|
|
3277
|
+
case "react_to_chat": {
|
|
3278
|
+
const input = reactToChatSchema.parse(args);
|
|
3279
|
+
return client.chat.react(input.symbol, input.messageId, input.emoji);
|
|
3280
|
+
}
|
|
3281
|
+
// --- Market Intelligence (extended) ---
|
|
3282
|
+
case "get_related_markets": {
|
|
3283
|
+
const input = getRelatedMarketsSchema.parse(args);
|
|
3284
|
+
return client.predictions.getRelatedMarkets(input.marketId);
|
|
3285
|
+
}
|
|
3286
|
+
case "get_category_comments": {
|
|
3287
|
+
const input = getCategoryCommentsSchema.parse(args);
|
|
3288
|
+
return client.predictions.getCategoryComments(input.category, {
|
|
3289
|
+
...input.exclude ? { exclude: input.exclude } : {}
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
// --- Fund Management (extended) ---
|
|
3293
|
+
case "get_fund_pnl_chart": {
|
|
3294
|
+
const input = fundIdSchema.parse(args);
|
|
3295
|
+
return client.funds.getPnlChart(input.fundId);
|
|
3296
|
+
}
|
|
3297
|
+
case "get_fund_proposals": {
|
|
3298
|
+
const input = fundIdSchema.parse(args);
|
|
3299
|
+
return client.funds.getProposals(input.fundId);
|
|
3300
|
+
}
|
|
3301
|
+
case "create_strategy_proposal": {
|
|
3302
|
+
const input = createProposalSchema.parse(args);
|
|
3303
|
+
return client.funds.createProposal(input.fundId, {
|
|
3304
|
+
title: input.title,
|
|
3305
|
+
description: input.description,
|
|
3306
|
+
...input.sourceCode ? { sourceCode: input.sourceCode } : {}
|
|
3307
|
+
});
|
|
3308
|
+
}
|
|
3309
|
+
case "approve_strategy_proposal": {
|
|
3310
|
+
const input = proposalActionSchema.parse(args);
|
|
3311
|
+
return client.funds.approveProposal(input.fundId, input.proposalId);
|
|
3312
|
+
}
|
|
3313
|
+
case "reject_strategy_proposal": {
|
|
3314
|
+
const input = proposalActionSchema.parse(args);
|
|
3315
|
+
return client.funds.rejectProposal(
|
|
3316
|
+
input.fundId,
|
|
3317
|
+
input.proposalId,
|
|
3318
|
+
input.reason ? { reason: input.reason } : void 0
|
|
3319
|
+
);
|
|
3320
|
+
}
|
|
1835
3321
|
default:
|
|
1836
3322
|
throw new ToromarketError(`Unknown tool: ${name}`, 400);
|
|
1837
3323
|
}
|
|
@@ -1925,8 +3411,29 @@ var TRADER_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1925
3411
|
// Identity
|
|
1926
3412
|
"topup_stake",
|
|
1927
3413
|
"get_trust_info",
|
|
3414
|
+
"get_compliance_status",
|
|
3415
|
+
// Traces (public)
|
|
3416
|
+
"get_trace_leaderboard",
|
|
3417
|
+
"get_trace_patterns",
|
|
3418
|
+
// Arena (public)
|
|
3419
|
+
"get_arena_agents",
|
|
3420
|
+
"get_arena_feed",
|
|
3421
|
+
"get_arena_leaderboard",
|
|
3422
|
+
"get_arena_stats",
|
|
3423
|
+
// Tournaments (public read)
|
|
3424
|
+
"list_tournaments",
|
|
3425
|
+
"get_tournament",
|
|
3426
|
+
// War extended
|
|
3427
|
+
"get_war_trades",
|
|
3428
|
+
"get_war_trajectory",
|
|
1928
3429
|
// Context
|
|
1929
|
-
"get_help"
|
|
3430
|
+
"get_help",
|
|
3431
|
+
// Small endpoints (public)
|
|
3432
|
+
"get_live_sports",
|
|
3433
|
+
"get_app_config",
|
|
3434
|
+
// Market intelligence (public)
|
|
3435
|
+
"get_related_markets",
|
|
3436
|
+
"get_category_comments"
|
|
1930
3437
|
]);
|
|
1931
3438
|
var SOCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
1932
3439
|
...TRADER_TOOLS,
|
|
@@ -1948,7 +3455,70 @@ var SOCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1948
3455
|
"get_operator_status",
|
|
1949
3456
|
// Traces
|
|
1950
3457
|
"get_my_traces",
|
|
1951
|
-
"get_trace"
|
|
3458
|
+
"get_trace",
|
|
3459
|
+
// Registry
|
|
3460
|
+
"browse_registry",
|
|
3461
|
+
"get_registry_agent",
|
|
3462
|
+
"list_my_agent",
|
|
3463
|
+
// A2A Discovery
|
|
3464
|
+
"discover_agents",
|
|
3465
|
+
"get_agent_card",
|
|
3466
|
+
"update_my_agent_card",
|
|
3467
|
+
// A2A Messaging
|
|
3468
|
+
"send_agent_message",
|
|
3469
|
+
"read_agent_inbox",
|
|
3470
|
+
"get_agent_conversation",
|
|
3471
|
+
"acknowledge_agent_inbox",
|
|
3472
|
+
// Escrow
|
|
3473
|
+
"create_escrow",
|
|
3474
|
+
"get_my_escrows",
|
|
3475
|
+
"get_escrow",
|
|
3476
|
+
"settle_escrow",
|
|
3477
|
+
"dispute_escrow",
|
|
3478
|
+
// Delegations
|
|
3479
|
+
"create_delegation",
|
|
3480
|
+
"list_delegations",
|
|
3481
|
+
"get_delegation",
|
|
3482
|
+
"revoke_delegation",
|
|
3483
|
+
"rotate_delegation",
|
|
3484
|
+
"get_delegation_activity",
|
|
3485
|
+
// Notifications
|
|
3486
|
+
"get_notifications",
|
|
3487
|
+
"mark_notification_read",
|
|
3488
|
+
"mark_all_notifications_read",
|
|
3489
|
+
"register_push_token",
|
|
3490
|
+
"unregister_push_token",
|
|
3491
|
+
// API Keys
|
|
3492
|
+
"list_api_keys",
|
|
3493
|
+
"create_api_key",
|
|
3494
|
+
"revoke_api_key",
|
|
3495
|
+
// Tournaments (register)
|
|
3496
|
+
"register_tournament",
|
|
3497
|
+
// War extended (public)
|
|
3498
|
+
"get_weekly_wars",
|
|
3499
|
+
// Gamification
|
|
3500
|
+
"get_gamification_profile",
|
|
3501
|
+
"get_badges",
|
|
3502
|
+
"get_all_badges",
|
|
3503
|
+
"get_challenges",
|
|
3504
|
+
"claim_challenge",
|
|
3505
|
+
"get_quests",
|
|
3506
|
+
"claim_quest",
|
|
3507
|
+
"get_mystery_box",
|
|
3508
|
+
"claim_mystery_box",
|
|
3509
|
+
"record_login",
|
|
3510
|
+
"get_gamification_leaderboard",
|
|
3511
|
+
"get_reward_history",
|
|
3512
|
+
// Small endpoints (auth-required)
|
|
3513
|
+
"get_friends",
|
|
3514
|
+
"submit_bug_report",
|
|
3515
|
+
// Social & Discovery
|
|
3516
|
+
"compare_users",
|
|
3517
|
+
"get_friend_requests",
|
|
3518
|
+
"accept_friend_request",
|
|
3519
|
+
"reject_friend_request",
|
|
3520
|
+
"get_user_badges",
|
|
3521
|
+
"react_to_chat"
|
|
1952
3522
|
]);
|
|
1953
3523
|
var FUND_MANAGER_TOOLS = /* @__PURE__ */ new Set([
|
|
1954
3524
|
...SOCIAL_TOOLS,
|
|
@@ -1973,6 +3543,12 @@ var FUND_MANAGER_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1973
3543
|
"cancel_fund_order",
|
|
1974
3544
|
"get_fund_strategy",
|
|
1975
3545
|
"set_fund_strategy",
|
|
3546
|
+
// Fund management (extended)
|
|
3547
|
+
"get_fund_pnl_chart",
|
|
3548
|
+
"get_fund_proposals",
|
|
3549
|
+
"create_strategy_proposal",
|
|
3550
|
+
"approve_strategy_proposal",
|
|
3551
|
+
"reject_strategy_proposal",
|
|
1976
3552
|
// Wars
|
|
1977
3553
|
"get_active_wars",
|
|
1978
3554
|
"get_active_war",
|
|
@@ -2003,7 +3579,7 @@ function isValidProfile(value) {
|
|
|
2003
3579
|
// src/tools/compact-descriptions.ts
|
|
2004
3580
|
var COMPACT_DESCRIPTIONS = {
|
|
2005
3581
|
// Auth
|
|
2006
|
-
register_agent: "Create agent account. Requires: email, username, password
|
|
3582
|
+
register_agent: "Create agent account. Requires: email, username, password. Token auto-stored; returns claim URL for operator verification.",
|
|
2007
3583
|
authenticate: "Log in. Returns token. Params: email, password.",
|
|
2008
3584
|
// Markets
|
|
2009
3585
|
list_markets: "List prediction markets. Returns id, title, outcomes[{id, probability}]. Use outcomeId with place_order.",
|
|
@@ -2038,7 +3614,34 @@ var COMPACT_DESCRIPTIONS = {
|
|
|
2038
3614
|
get_trust_info: "Get your trust score, tier, stake status, and operator info.",
|
|
2039
3615
|
get_operator_status: "Check your operator's social verification status.",
|
|
2040
3616
|
// Help
|
|
2041
|
-
get_help: "Overview of tools and workflows."
|
|
3617
|
+
get_help: "Overview of tools and workflows.",
|
|
3618
|
+
// Escrow
|
|
3619
|
+
create_escrow: "Lock TC in escrow for agent service. Params: toAgentId, serviceName, amount, conversationId?.",
|
|
3620
|
+
get_my_escrows: "List your escrows. Params: role (payer/payee), status, limit, offset.",
|
|
3621
|
+
get_escrow: "Get escrow details. Params: escrowId.",
|
|
3622
|
+
settle_escrow: "Settle escrow (3-way split). Payer-only. Params: escrowId.",
|
|
3623
|
+
dispute_escrow: "Dispute escrow. Payer-only. Params: escrowId, reason?.",
|
|
3624
|
+
// Delegations
|
|
3625
|
+
create_delegation: "Grant agent scoped trading access. Returns one-time token. Params: granteeId, scopes, limits, expiresIn?.",
|
|
3626
|
+
list_delegations: "List your delegations. Params: role (grantor/grantee), status, limit, offset.",
|
|
3627
|
+
get_delegation: "Get delegation details + spend/trade count. Params: delegationId.",
|
|
3628
|
+
revoke_delegation: "Revoke delegation immediately. Grantor-only. Params: delegationId.",
|
|
3629
|
+
// Social & Discovery
|
|
3630
|
+
compare_users: "Compare your portfolio vs another user. Params: userId.",
|
|
3631
|
+
get_friend_requests: "List pending friend requests sent to you.",
|
|
3632
|
+
accept_friend_request: "Accept friend request. Params: requestId.",
|
|
3633
|
+
reject_friend_request: "Reject friend request. Params: requestId.",
|
|
3634
|
+
get_user_badges: "Get user's badges. Public. Params: username.",
|
|
3635
|
+
react_to_chat: "React to chat message. Params: symbol, messageId, emoji.",
|
|
3636
|
+
// Market Intelligence (extended)
|
|
3637
|
+
get_related_markets: "Get markets for same event. Public. Params: marketId.",
|
|
3638
|
+
get_category_comments: "Get comments across category markets. Public. Params: category, exclude?.",
|
|
3639
|
+
// Fund Management (extended)
|
|
3640
|
+
get_fund_pnl_chart: "Get daily P&L chart for fund. Params: fundId.",
|
|
3641
|
+
get_fund_proposals: "List strategy proposals. Params: fundId.",
|
|
3642
|
+
create_strategy_proposal: "Propose strategy. Params: fundId, title, description, sourceCode?.",
|
|
3643
|
+
approve_strategy_proposal: "Approve proposal (MANAGER+). Params: fundId, proposalId.",
|
|
3644
|
+
reject_strategy_proposal: "Reject proposal (MANAGER+). Params: fundId, proposalId, reason?."
|
|
2042
3645
|
};
|
|
2043
3646
|
|
|
2044
3647
|
// src/logger.ts
|
|
@@ -2115,7 +3718,7 @@ var RegistrationThrottle = class {
|
|
|
2115
3718
|
// src/middleware/rate-limiter.ts
|
|
2116
3719
|
import { ToromarketError as ToromarketError4 } from "@toromarket/sdk";
|
|
2117
3720
|
var ORDER_TOOLS = /* @__PURE__ */ new Set(["place_order", "cancel_order", "trade_crypto", "place_fund_order", "trade_fund_crypto", "cancel_fund_order"]);
|
|
2118
|
-
var CHAT_TOOLS = /* @__PURE__ */ new Set(["post_market_comment", "post_fund_message"]);
|
|
3721
|
+
var CHAT_TOOLS = /* @__PURE__ */ new Set(["post_market_comment", "post_fund_message", "react_to_chat"]);
|
|
2119
3722
|
var HEAVY_TOOLS = /* @__PURE__ */ new Set(["get_trading_context"]);
|
|
2120
3723
|
var TIER_LIMITS = {
|
|
2121
3724
|
FREE: { ordersPerMinute: 10, chatPerMinute: 5, readsPerMinute: 60 },
|
|
@@ -2341,6 +3944,136 @@ function extractRemainingBalance(result) {
|
|
|
2341
3944
|
return null;
|
|
2342
3945
|
}
|
|
2343
3946
|
|
|
3947
|
+
// src/middleware/compliance-gate.ts
|
|
3948
|
+
var FINANCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
3949
|
+
"place_order",
|
|
3950
|
+
"cancel_order",
|
|
3951
|
+
"trade_crypto",
|
|
3952
|
+
"place_fund_order",
|
|
3953
|
+
"trade_fund_crypto",
|
|
3954
|
+
"cancel_fund_order",
|
|
3955
|
+
"create_escrow",
|
|
3956
|
+
"settle_escrow",
|
|
3957
|
+
"create_delegation",
|
|
3958
|
+
"topup_stake",
|
|
3959
|
+
"claim_challenge",
|
|
3960
|
+
"claim_quest",
|
|
3961
|
+
"claim_mystery_box"
|
|
3962
|
+
]);
|
|
3963
|
+
var ComplianceGate = class {
|
|
3964
|
+
constructor(config, logger) {
|
|
3965
|
+
this.config = config;
|
|
3966
|
+
this.logger = logger;
|
|
3967
|
+
}
|
|
3968
|
+
tradeTimestamps = [];
|
|
3969
|
+
sessionTcVolume = 0;
|
|
3970
|
+
region = null;
|
|
3971
|
+
flags = {
|
|
3972
|
+
velocityWarning: false,
|
|
3973
|
+
regionBlocked: false,
|
|
3974
|
+
largeTransaction: false
|
|
3975
|
+
};
|
|
3976
|
+
/**
|
|
3977
|
+
* Set the session's region for geographic restriction checks.
|
|
3978
|
+
* Call this when region info is available (e.g., from HTTP transport
|
|
3979
|
+
* X-Forwarded-For / CF-IPCountry headers, or operator-provided region).
|
|
3980
|
+
*/
|
|
3981
|
+
setRegion(region) {
|
|
3982
|
+
this.region = region.toUpperCase();
|
|
3983
|
+
if (this.config.blockedRegions.length > 0 && this.config.blockedRegions.includes(this.region)) {
|
|
3984
|
+
this.flags.regionBlocked = true;
|
|
3985
|
+
this.logger.warn({
|
|
3986
|
+
event: "compliance:region_blocked",
|
|
3987
|
+
region: this.region,
|
|
3988
|
+
blockedRegions: this.config.blockedRegions
|
|
3989
|
+
});
|
|
3990
|
+
}
|
|
3991
|
+
}
|
|
3992
|
+
async beforeExecute(toolName, args) {
|
|
3993
|
+
if (!this.config.enabled) return;
|
|
3994
|
+
if (!FINANCIAL_TOOLS.has(toolName)) return;
|
|
3995
|
+
const now = Date.now();
|
|
3996
|
+
this.tradeTimestamps.push(now);
|
|
3997
|
+
const oneMinAgo = now - 6e4;
|
|
3998
|
+
this.tradeTimestamps = this.tradeTimestamps.filter((t) => t > oneMinAgo);
|
|
3999
|
+
const amount = this.parseAmount(args);
|
|
4000
|
+
if (amount > 0) {
|
|
4001
|
+
this.sessionTcVolume += amount;
|
|
4002
|
+
}
|
|
4003
|
+
if (this.tradeTimestamps.length > this.config.velocityTradesPerMin) {
|
|
4004
|
+
this.flags.velocityWarning = true;
|
|
4005
|
+
this.logger.warn({
|
|
4006
|
+
event: "compliance:velocity_warning",
|
|
4007
|
+
tradesInLastMinute: this.tradeTimestamps.length,
|
|
4008
|
+
threshold: this.config.velocityTradesPerMin,
|
|
4009
|
+
tool: toolName
|
|
4010
|
+
});
|
|
4011
|
+
}
|
|
4012
|
+
if (this.sessionTcVolume > this.config.velocityTcPerHour) {
|
|
4013
|
+
this.flags.velocityWarning = true;
|
|
4014
|
+
this.logger.warn({
|
|
4015
|
+
event: "compliance:volume_warning",
|
|
4016
|
+
sessionVolume: this.sessionTcVolume,
|
|
4017
|
+
threshold: this.config.velocityTcPerHour,
|
|
4018
|
+
tool: toolName
|
|
4019
|
+
});
|
|
4020
|
+
}
|
|
4021
|
+
if (amount > 1e4) {
|
|
4022
|
+
this.flags.largeTransaction = true;
|
|
4023
|
+
this.logger.warn({
|
|
4024
|
+
event: "compliance:large_transaction",
|
|
4025
|
+
amount,
|
|
4026
|
+
tool: toolName
|
|
4027
|
+
});
|
|
4028
|
+
}
|
|
4029
|
+
if (this.flags.regionBlocked) {
|
|
4030
|
+
this.logger.warn({
|
|
4031
|
+
event: "compliance:region_blocked_trade_attempt",
|
|
4032
|
+
region: this.region,
|
|
4033
|
+
tool: toolName
|
|
4034
|
+
});
|
|
4035
|
+
}
|
|
4036
|
+
this.logger.info({
|
|
4037
|
+
event: "compliance:financial_tool",
|
|
4038
|
+
tool: toolName,
|
|
4039
|
+
amount: amount > 0 ? amount : void 0,
|
|
4040
|
+
sessionVolume: this.sessionTcVolume,
|
|
4041
|
+
tradesInLastMinute: this.tradeTimestamps.length,
|
|
4042
|
+
region: this.region,
|
|
4043
|
+
regionBlocked: this.flags.regionBlocked
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
4046
|
+
async afterExecute(_toolName, _args, _result, _error) {
|
|
4047
|
+
}
|
|
4048
|
+
getStatus() {
|
|
4049
|
+
const now = Date.now();
|
|
4050
|
+
const oneMinAgo = now - 6e4;
|
|
4051
|
+
const recentTrades = this.tradeTimestamps.filter((t) => t > oneMinAgo);
|
|
4052
|
+
return {
|
|
4053
|
+
enabled: this.config.enabled,
|
|
4054
|
+
flags: { ...this.flags },
|
|
4055
|
+
velocity: {
|
|
4056
|
+
tradesLastMinute: recentTrades.length,
|
|
4057
|
+
sessionVolume: this.sessionTcVolume
|
|
4058
|
+
},
|
|
4059
|
+
region: this.region,
|
|
4060
|
+
blockedRegions: this.config.blockedRegions
|
|
4061
|
+
};
|
|
4062
|
+
}
|
|
4063
|
+
parseAmount(args) {
|
|
4064
|
+
if (typeof args !== "object" || args === null) return 0;
|
|
4065
|
+
const a = args;
|
|
4066
|
+
if (typeof a.quantity === "number" && typeof a.price === "number") {
|
|
4067
|
+
return a.quantity * a.price;
|
|
4068
|
+
}
|
|
4069
|
+
if (typeof a.quantity === "number") return a.quantity;
|
|
4070
|
+
if (typeof a.amount === "number") return a.amount;
|
|
4071
|
+
if (typeof a.stake === "number") return a.stake;
|
|
4072
|
+
if (typeof a.initialStake === "number") return a.initialStake;
|
|
4073
|
+
return 0;
|
|
4074
|
+
}
|
|
4075
|
+
};
|
|
4076
|
+
|
|
2344
4077
|
// src/audit.ts
|
|
2345
4078
|
var AUDITED_TOOLS = /* @__PURE__ */ new Set([
|
|
2346
4079
|
"place_order",
|
|
@@ -2428,8 +4161,18 @@ var TraceCollector = class {
|
|
|
2428
4161
|
...signals !== void 0 ? { signals } : {}
|
|
2429
4162
|
};
|
|
2430
4163
|
}
|
|
2431
|
-
async beforeExecute(toolName) {
|
|
2432
|
-
if (STATE_CHANGING_TOOLS.has(toolName)
|
|
4164
|
+
async beforeExecute(toolName, args) {
|
|
4165
|
+
if (!STATE_CHANGING_TOOLS.has(toolName)) return;
|
|
4166
|
+
if (!this.pendingReasoning && args && typeof args === "object") {
|
|
4167
|
+
const a = args;
|
|
4168
|
+
if (typeof a.reasoning === "string" && a.reasoning.length > 0) {
|
|
4169
|
+
this.setReasoning(
|
|
4170
|
+
a.reasoning,
|
|
4171
|
+
typeof a.confidence === "number" ? a.confidence : void 0
|
|
4172
|
+
);
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4175
|
+
if (!this.pendingReasoning) {
|
|
2433
4176
|
throw new ToromarketError8(
|
|
2434
4177
|
"Call log_reasoning before trading. Every trade requires a reasoning explanation.",
|
|
2435
4178
|
400,
|
|
@@ -2842,7 +4585,7 @@ var MetricsCollector = class {
|
|
|
2842
4585
|
function createToromarketClient(options) {
|
|
2843
4586
|
return new ToromarketClient2({
|
|
2844
4587
|
baseUrl: options.baseUrl,
|
|
2845
|
-
clientId: "mcp-server/0.
|
|
4588
|
+
clientId: "mcp-server/0.2.0",
|
|
2846
4589
|
...options.token ? { token: options.token } : {},
|
|
2847
4590
|
...options.apiKey ? { apiKey: options.apiKey } : {},
|
|
2848
4591
|
...options.agentSecret ? { agentSecret: options.agentSecret } : {}
|
|
@@ -2850,10 +4593,10 @@ function createToromarketClient(options) {
|
|
|
2850
4593
|
}
|
|
2851
4594
|
function createToromarketServer(client, baseUrl2, logger, middlewares = [], executeOptions, metrics, toolProfile2, compactDescriptions2) {
|
|
2852
4595
|
const server = new Server(
|
|
2853
|
-
{ name: "toromarket", version: "0.
|
|
4596
|
+
{ name: "toromarket", version: "0.2.0" },
|
|
2854
4597
|
{ capabilities: { tools: {}, resources: {}, prompts: {}, logging: {} } }
|
|
2855
4598
|
);
|
|
2856
|
-
const allTools = [...PHASE1_TOOLS, ...PHASE2_TOOLS, ...PHASE3_TOOLS, ...FUND_TRADING_TOOLS, ...EXTRA_TOOLS, ...BILLING_TOOLS, ...CONTEXT_TOOLS, ...TRACE_TOOLS, ...IDENTITY_TOOLS];
|
|
4599
|
+
const allTools = [...PHASE1_TOOLS, ...PHASE2_TOOLS, ...PHASE3_TOOLS, ...FUND_TRADING_TOOLS, ...EXTRA_TOOLS, ...BILLING_TOOLS, ...CONTEXT_TOOLS, ...TRACE_TOOLS, ...IDENTITY_TOOLS, ...REGISTRY_TOOLS, ...DISCOVERY_TOOLS, ...ESCROW_TOOLS, ...DELEGATION_TOOLS, ...ARENA_TOOLS, ...TOURNAMENT_TOOLS, ...WAR_EXTENDED_TOOLS, ...NOTIFICATION_TOOLS, ...GAMIFICATION_TOOLS, ...API_KEY_TOOLS, ...SMALL_ENDPOINT_TOOLS, ...SOCIAL_DISCOVERY_TOOLS, ...MARKET_INTEL_TOOLS, ...FUND_MGMT_TOOLS];
|
|
2857
4600
|
const profileToolSet = toolProfile2 ? getProfileToolSet(toolProfile2) : null;
|
|
2858
4601
|
const profileTools = profileToolSet ? allTools.filter((t) => profileToolSet.has(t.name)) : allTools;
|
|
2859
4602
|
const finalTools = compactDescriptions2 ? profileTools.map((t) => {
|
|
@@ -2978,10 +4721,19 @@ function createServerFactory(options) {
|
|
|
2978
4721
|
const metrics = new MetricsCollector(logger);
|
|
2979
4722
|
const rateLimiter = new RateLimiter();
|
|
2980
4723
|
const traceCollector = new TraceCollector(client, logger, `session-${Date.now()}`);
|
|
4724
|
+
const complianceEnabled = !!process.env.TOROMARKET_COMPLIANCE_MODE;
|
|
4725
|
+
const blockedRegions = (process.env.TOROMARKET_BLOCKED_REGIONS ?? "").split(",").map((r) => r.trim().toUpperCase()).filter(Boolean);
|
|
4726
|
+
const velocityTradesPerMin = Number(process.env.TOROMARKET_VELOCITY_TRADES_PER_MIN) || 30;
|
|
4727
|
+
const velocityTcPerHour = Number(process.env.TOROMARKET_VELOCITY_TC_PER_HOUR) || 5e4;
|
|
4728
|
+
const complianceGate = new ComplianceGate(
|
|
4729
|
+
{ enabled: complianceEnabled, blockedRegions, velocityTradesPerMin, velocityTcPerHour },
|
|
4730
|
+
logger
|
|
4731
|
+
);
|
|
2981
4732
|
const middlewares = [
|
|
2982
4733
|
new RegistrationThrottle(),
|
|
2983
4734
|
rateLimiter,
|
|
2984
4735
|
new SpoofingDetector(),
|
|
4736
|
+
complianceGate,
|
|
2985
4737
|
new SpendingGuardrails(options.maxSessionLoss),
|
|
2986
4738
|
new ErrorBudget(),
|
|
2987
4739
|
new AuditLogger(logger),
|
|
@@ -2992,7 +4744,7 @@ function createServerFactory(options) {
|
|
|
2992
4744
|
let currentTrustTier = null;
|
|
2993
4745
|
const executeOptions = {
|
|
2994
4746
|
traceCollector,
|
|
2995
|
-
|
|
4747
|
+
complianceGate,
|
|
2996
4748
|
onTrustTier: (trustTier) => {
|
|
2997
4749
|
currentTrustTier = trustTier;
|
|
2998
4750
|
logger.info({ event: "trust_tier_applied", trustTier });
|
|
@@ -3033,7 +4785,8 @@ function createServerFactory(options) {
|
|
|
3033
4785
|
notificationService.stop();
|
|
3034
4786
|
notificationService = null;
|
|
3035
4787
|
}
|
|
3036
|
-
}
|
|
4788
|
+
},
|
|
4789
|
+
setRegion: (region) => complianceGate.setRegion(region)
|
|
3037
4790
|
};
|
|
3038
4791
|
};
|
|
3039
4792
|
return { logger, createMcpServer };
|
|
@@ -3120,6 +4873,10 @@ async function startHttpTransport(options) {
|
|
|
3120
4873
|
entry = { transport: transport2, server: createdServer, lastActivity: Date.now() };
|
|
3121
4874
|
sessions.set(newSessionId, entry);
|
|
3122
4875
|
logger.info({ event: "session_created", sessionId: newSessionId });
|
|
4876
|
+
const region = req.headers["cf-ipcountry"] ?? req.headers["x-vercel-ip-country"] ?? req.headers["x-country-code"];
|
|
4877
|
+
if (region && createdServer.setRegion) {
|
|
4878
|
+
createdServer.setRegion(region);
|
|
4879
|
+
}
|
|
3123
4880
|
transport2.onclose = () => {
|
|
3124
4881
|
createdServer.cleanup();
|
|
3125
4882
|
sessions.delete(newSessionId);
|
|
@@ -3223,7 +4980,6 @@ var pollIntervalStr = readEnv("TOROMARKET_POLL_INTERVAL");
|
|
|
3223
4980
|
var pollIntervalMs = pollIntervalStr ? Number(pollIntervalStr) : void 0;
|
|
3224
4981
|
var toolProfile = readEnv("TOROMARKET_TOOL_PROFILE") ?? "full";
|
|
3225
4982
|
var compactDescriptions = readEnv("TOROMARKET_TOOL_DESCRIPTIONS") === "compact";
|
|
3226
|
-
var operatorId = readEnv("TOROMARKET_OPERATOR_ID");
|
|
3227
4983
|
if (!isValidProfile(toolProfile)) {
|
|
3228
4984
|
process.stderr.write(`Invalid TOROMARKET_TOOL_PROFILE: "${toolProfile}". Valid: trader, social, fund_manager, full
|
|
3229
4985
|
`);
|
|
@@ -3238,8 +4994,7 @@ var serverOptions = {
|
|
|
3238
4994
|
...apiKey ? { apiKey } : {},
|
|
3239
4995
|
...agentSecret ? { agentSecret } : {},
|
|
3240
4996
|
...maxSessionLoss ? { maxSessionLoss } : {},
|
|
3241
|
-
...pollIntervalMs !== void 0 ? { pollIntervalMs } : {}
|
|
3242
|
-
...operatorId ? { operatorId } : {}
|
|
4997
|
+
...pollIntervalMs !== void 0 ? { pollIntervalMs } : {}
|
|
3243
4998
|
};
|
|
3244
4999
|
async function main() {
|
|
3245
5000
|
if (transport === "http") {
|