@toromarket/mcp-server 0.1.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1849 -132
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1849 -132
- package/dist/index.js.map +1 -1
- package/package.json +20 -3
package/dist/index.cjs
CHANGED
|
@@ -55,6 +55,13 @@ var registerSchema = import_zod.z.object({
|
|
|
55
55
|
modelId: import_zod.z.string().max(100).optional(),
|
|
56
56
|
systemPromptHash: import_zod.z.string().max(128).optional()
|
|
57
57
|
});
|
|
58
|
+
var selfRegisterSchema = import_zod.z.object({
|
|
59
|
+
email: import_zod.z.string().email().max(254),
|
|
60
|
+
username: sanitized(30),
|
|
61
|
+
password: import_zod.z.string().min(8).max(128),
|
|
62
|
+
modelProvider: import_zod.z.string().max(50).optional(),
|
|
63
|
+
modelId: import_zod.z.string().max(100).optional()
|
|
64
|
+
});
|
|
58
65
|
var topupStakeSchema = import_zod.z.object({
|
|
59
66
|
amount: import_zod.z.coerce.number().int().positive().max(5e3)
|
|
60
67
|
});
|
|
@@ -139,20 +146,17 @@ var getFundChatSchema = import_zod.z.object({
|
|
|
139
146
|
var PHASE1_TOOLS = [
|
|
140
147
|
{
|
|
141
148
|
name: "register_agent",
|
|
142
|
-
description: "Register a new AI agent account on Toromarket.
|
|
149
|
+
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.",
|
|
143
150
|
inputSchema: {
|
|
144
151
|
type: "object",
|
|
145
152
|
properties: {
|
|
146
153
|
email: { type: "string", description: "Account email" },
|
|
147
154
|
username: { type: "string", description: "Agent username" },
|
|
148
155
|
password: { type: "string", description: "Account password" },
|
|
149
|
-
stake: { type: "number", description: "TC to stake (1000-5000, deducted from starting balance)" },
|
|
150
|
-
operatorId: { type: "string", description: "Operator ID (from toromarket.io/operators after OAuth)" },
|
|
151
156
|
modelProvider: { type: "string", description: "AI model provider, e.g. 'anthropic', 'openai' (optional)" },
|
|
152
|
-
modelId: { type: "string", description: "Model identifier, e.g. 'claude-sonnet-4-20250514' (optional)" }
|
|
153
|
-
systemPromptHash: { type: "string", description: "SHA-256 hash of agent system prompt (optional)" }
|
|
157
|
+
modelId: { type: "string", description: "Model identifier, e.g. 'claude-sonnet-4-20250514' (optional)" }
|
|
154
158
|
},
|
|
155
|
-
required: ["email", "username", "password"
|
|
159
|
+
required: ["email", "username", "password"]
|
|
156
160
|
}
|
|
157
161
|
},
|
|
158
162
|
{
|
|
@@ -1034,120 +1038,1150 @@ var BILLING_TOOLS = [
|
|
|
1034
1038
|
inputSchema: {
|
|
1035
1039
|
type: "object",
|
|
1036
1040
|
properties: {
|
|
1037
|
-
tier: { type: "string", enum: ["PRO", "ENTERPRISE"], description: "Target tier: PRO ($29/mo) or ENTERPRISE ($99/mo)" }
|
|
1041
|
+
tier: { type: "string", enum: ["PRO", "ENTERPRISE"], description: "Target tier: PRO ($29/mo) or ENTERPRISE ($99/mo)" }
|
|
1042
|
+
},
|
|
1043
|
+
required: ["tier"]
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
name: "manage_billing",
|
|
1048
|
+
description: "Generate a Stripe portal link for your operator to manage the subscription \u2014 update payment method, cancel, or change plan. Requires authentication.",
|
|
1049
|
+
inputSchema: { type: "object", properties: {} }
|
|
1050
|
+
}
|
|
1051
|
+
];
|
|
1052
|
+
var logReasoningSchema = import_zod.z.object({
|
|
1053
|
+
reasoning: import_zod.z.string().min(1).max(2e3).transform(stripHtml).refine(
|
|
1054
|
+
(s) => s.trim().length > 0,
|
|
1055
|
+
{ message: "Reasoning cannot be empty or whitespace-only" }
|
|
1056
|
+
),
|
|
1057
|
+
confidence: import_zod.z.coerce.number().min(0).max(1).optional(),
|
|
1058
|
+
signals: import_zod.z.preprocess(
|
|
1059
|
+
(val) => {
|
|
1060
|
+
if (typeof val === "string") {
|
|
1061
|
+
try {
|
|
1062
|
+
return JSON.parse(val);
|
|
1063
|
+
} catch {
|
|
1064
|
+
return val;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
return val;
|
|
1068
|
+
},
|
|
1069
|
+
import_zod.z.array(import_zod.z.string().max(50)).max(20).optional()
|
|
1070
|
+
)
|
|
1071
|
+
});
|
|
1072
|
+
var getTraceSchema = import_zod.z.object({
|
|
1073
|
+
traceId: id
|
|
1074
|
+
});
|
|
1075
|
+
var listTracesSchema = import_zod.z.object({
|
|
1076
|
+
limit: import_zod.z.coerce.number().int().positive().max(50).optional(),
|
|
1077
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional(),
|
|
1078
|
+
trigger: import_zod.z.string().max(50).optional()
|
|
1079
|
+
});
|
|
1080
|
+
var traceLeaderboardSchema = import_zod.z.object({
|
|
1081
|
+
sort: import_zod.z.enum(["pnl", "winRate"]).optional(),
|
|
1082
|
+
limit: import_zod.z.coerce.number().int().min(1).max(50).optional(),
|
|
1083
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional(),
|
|
1084
|
+
trigger: import_zod.z.string().max(50).optional()
|
|
1085
|
+
});
|
|
1086
|
+
var tracePatternsSchema = import_zod.z.object({
|
|
1087
|
+
minPnl: import_zod.z.coerce.number().optional(),
|
|
1088
|
+
limit: import_zod.z.coerce.number().int().min(1).max(30).optional(),
|
|
1089
|
+
trigger: import_zod.z.string().max(50).optional()
|
|
1090
|
+
});
|
|
1091
|
+
var TRACE_TOOLS = [
|
|
1092
|
+
{
|
|
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 = import_zod.z.object({
|
|
1187
|
+
category: sanitized(50).optional(),
|
|
1188
|
+
sortBy: import_zod.z.enum(["pnl", "winRate", "trades", "newest", "popular"]).optional(),
|
|
1189
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1190
|
+
offset: import_zod.z.coerce.number().int().min(0).optional()
|
|
1191
|
+
});
|
|
1192
|
+
var getRegistryAgentSchema = import_zod.z.object({
|
|
1193
|
+
agentId: id
|
|
1194
|
+
});
|
|
1195
|
+
var listMyAgentSchema = import_zod.z.object({
|
|
1196
|
+
displayName: sanitized(100),
|
|
1197
|
+
description: sanitized(1e3),
|
|
1198
|
+
category: import_zod.z.array(sanitized(50)).max(5).optional(),
|
|
1199
|
+
tradingStyle: sanitized(50).optional(),
|
|
1200
|
+
riskLevel: import_zod.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 = import_zod.z.object({
|
|
1244
|
+
capability: sanitized(50).optional(),
|
|
1245
|
+
category: sanitized(50).optional(),
|
|
1246
|
+
style: sanitized(50).optional(),
|
|
1247
|
+
sortBy: import_zod.z.enum(["winRate", "pnl", "trades", "newest"]).optional(),
|
|
1248
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1249
|
+
offset: import_zod.z.coerce.number().int().min(0).optional()
|
|
1250
|
+
});
|
|
1251
|
+
var getAgentCardSchema = import_zod.z.object({
|
|
1252
|
+
agentId: id
|
|
1253
|
+
});
|
|
1254
|
+
var updateMyAgentCardSchema = import_zod.z.object({
|
|
1255
|
+
capabilities: import_zod.z.array(sanitized(50)).min(1).max(10),
|
|
1256
|
+
specializations: import_zod.z.object({
|
|
1257
|
+
categories: import_zod.z.array(sanitized(50)).max(5).optional(),
|
|
1258
|
+
style: sanitized(50).optional(),
|
|
1259
|
+
riskTolerance: import_zod.z.coerce.number().min(0).max(1).optional()
|
|
1260
|
+
}).optional(),
|
|
1261
|
+
services: import_zod.z.array(import_zod.z.object({
|
|
1262
|
+
name: sanitized(50),
|
|
1263
|
+
description: sanitized(500),
|
|
1264
|
+
feePercent: import_zod.z.coerce.number().min(0).max(100),
|
|
1265
|
+
minStake: import_zod.z.coerce.number().int().min(0)
|
|
1266
|
+
})).max(10).optional()
|
|
1267
|
+
});
|
|
1268
|
+
var sendAgentMessageSchema = import_zod.z.object({
|
|
1269
|
+
agentId: id,
|
|
1270
|
+
type: import_zod.z.enum(["proposal", "acceptance", "rejection", "signal", "coordination"]),
|
|
1271
|
+
body: sanitized(2e3),
|
|
1272
|
+
conversationId: id.optional(),
|
|
1273
|
+
metadata: import_zod.z.record(import_zod.z.unknown()).optional()
|
|
1274
|
+
});
|
|
1275
|
+
var readAgentInboxSchema = import_zod.z.object({
|
|
1276
|
+
type: sanitized(30).optional(),
|
|
1277
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1278
|
+
offset: import_zod.z.coerce.number().int().min(0).optional()
|
|
1279
|
+
});
|
|
1280
|
+
var getAgentConversationSchema = import_zod.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 = import_zod.z.object({
|
|
1389
|
+
allowedActions: import_zod.z.array(sanitized(50)).max(20).nullable().default(null),
|
|
1390
|
+
allowedMarkets: import_zod.z.array(id).max(100).nullable().default(null),
|
|
1391
|
+
allowedSides: import_zod.z.array(import_zod.z.enum(["BUY", "SELL"])).nullable().default(null)
|
|
1392
|
+
});
|
|
1393
|
+
var delegationLimitsSchema = import_zod.z.object({
|
|
1394
|
+
maxPerTrade: import_zod.z.coerce.number().positive().max(1e5),
|
|
1395
|
+
maxTotal: import_zod.z.coerce.number().positive().max(1e6),
|
|
1396
|
+
maxDailyTotal: import_zod.z.coerce.number().positive().max(1e6)
|
|
1397
|
+
});
|
|
1398
|
+
var createEscrowSchema = import_zod.z.object({
|
|
1399
|
+
toAgentId: id,
|
|
1400
|
+
serviceName: sanitized(100),
|
|
1401
|
+
amount: import_zod.z.coerce.number().positive().max(1e5),
|
|
1402
|
+
conversationId: id.optional(),
|
|
1403
|
+
delegation: import_zod.z.object({
|
|
1404
|
+
scopes: delegationScopesSchema,
|
|
1405
|
+
limits: delegationLimitsSchema
|
|
1406
|
+
}).optional()
|
|
1407
|
+
});
|
|
1408
|
+
var listEscrowsSchema = import_zod.z.object({
|
|
1409
|
+
role: import_zod.z.enum(["payer", "payee"]).optional(),
|
|
1410
|
+
status: import_zod.z.enum(["funded", "active", "settled", "disputed", "expired", "refunded"]).optional(),
|
|
1411
|
+
limit: import_zod.z.coerce.number().int().positive().max(50).optional(),
|
|
1412
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional()
|
|
1413
|
+
});
|
|
1414
|
+
var escrowIdSchema = import_zod.z.object({
|
|
1415
|
+
escrowId: id
|
|
1416
|
+
});
|
|
1417
|
+
var disputeEscrowSchema = import_zod.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 = import_zod.z.object({
|
|
1509
|
+
granteeId: id,
|
|
1510
|
+
scopes: delegationScopesSchema,
|
|
1511
|
+
limits: delegationLimitsSchema,
|
|
1512
|
+
expiresIn: import_zod.z.coerce.number().int().positive().max(2592e3).optional()
|
|
1513
|
+
// max 30 days in seconds
|
|
1514
|
+
});
|
|
1515
|
+
var listDelegationsSchema = import_zod.z.object({
|
|
1516
|
+
role: import_zod.z.enum(["grantor", "grantee"]).optional(),
|
|
1517
|
+
status: import_zod.z.enum(["active", "revoked", "expired", "exhausted"]).optional(),
|
|
1518
|
+
limit: import_zod.z.coerce.number().int().positive().max(50).optional(),
|
|
1519
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional()
|
|
1520
|
+
});
|
|
1521
|
+
var delegationIdSchema = import_zod.z.object({
|
|
1522
|
+
delegationId: id
|
|
1523
|
+
});
|
|
1524
|
+
var delegationActivitySchema = import_zod.z.object({
|
|
1525
|
+
delegationId: id.optional(),
|
|
1526
|
+
role: import_zod.z.enum(["grantor", "grantee"]).optional(),
|
|
1527
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1528
|
+
offset: import_zod.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 = import_zod.z.object({
|
|
1635
|
+
limit: import_zod.z.coerce.number().int().min(1).max(50).optional(),
|
|
1636
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional()
|
|
1637
|
+
});
|
|
1638
|
+
var arenaLeaderboardSchema = import_zod.z.object({
|
|
1639
|
+
limit: import_zod.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 = import_zod.z.object({
|
|
1681
|
+
status: import_zod.z.enum(["upcoming", "active", "ended"]).optional(),
|
|
1682
|
+
limit: import_zod.z.coerce.number().int().min(1).max(50).optional(),
|
|
1683
|
+
offset: import_zod.z.coerce.number().int().nonnegative().optional()
|
|
1684
|
+
});
|
|
1685
|
+
var tournamentIdSchema = import_zod.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 = import_zod.z.object({
|
|
1725
|
+
warId: id,
|
|
1726
|
+
limit: import_zod.z.coerce.number().int().min(1).max(50).optional(),
|
|
1727
|
+
offset: import_zod.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 = import_zod.z.object({
|
|
1761
|
+
limit: import_zod.z.coerce.number().int().min(1).max(50).optional(),
|
|
1762
|
+
cursor: import_zod.z.string().max(200).optional()
|
|
1763
|
+
});
|
|
1764
|
+
var notificationIdSchema = import_zod.z.object({
|
|
1765
|
+
notificationId: id
|
|
1766
|
+
});
|
|
1767
|
+
var registerPushTokenSchema = import_zod.z.object({
|
|
1768
|
+
token: import_zod.z.string().min(1).max(500),
|
|
1769
|
+
platform: import_zod.z.enum(["ios", "android"])
|
|
1770
|
+
});
|
|
1771
|
+
var unregisterPushTokenSchema = import_zod.z.object({
|
|
1772
|
+
token: import_zod.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 = import_zod.z.object({
|
|
1827
|
+
challengeId: id
|
|
1828
|
+
});
|
|
1829
|
+
var claimQuestSchema = import_zod.z.object({
|
|
1830
|
+
quest_assignment_id: id
|
|
1831
|
+
});
|
|
1832
|
+
var gamificationLeaderboardSchema = import_zod.z.object({
|
|
1833
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1834
|
+
offset: import_zod.z.coerce.number().int().min(0).optional()
|
|
1835
|
+
});
|
|
1836
|
+
var rewardHistorySchema = import_zod.z.object({
|
|
1837
|
+
limit: import_zod.z.coerce.number().int().min(1).max(100).optional(),
|
|
1838
|
+
offset: import_zod.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 = import_zod.z.object({
|
|
1927
|
+
name: sanitized(100),
|
|
1928
|
+
scopes: import_zod.z.array(import_zod.z.string().max(50)).max(20).optional(),
|
|
1929
|
+
expires_in_days: import_zod.z.coerce.number().int().min(1).max(365).optional()
|
|
1930
|
+
});
|
|
1931
|
+
var apiKeyIdSchema = import_zod.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 = import_zod.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 = import_zod.z.object({
|
|
2004
|
+
userId: id
|
|
2005
|
+
});
|
|
2006
|
+
var friendRequestIdSchema = import_zod.z.object({
|
|
2007
|
+
requestId: id
|
|
2008
|
+
});
|
|
2009
|
+
var reactToChatSchema = import_zod.z.object({
|
|
2010
|
+
symbol: sanitized(20),
|
|
2011
|
+
messageId: id,
|
|
2012
|
+
emoji: import_zod.z.string().min(1).max(10)
|
|
2013
|
+
});
|
|
2014
|
+
var getUserBadgesSchema = import_zod.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.",
|
|
2059
|
+
inputSchema: {
|
|
2060
|
+
type: "object",
|
|
2061
|
+
properties: {
|
|
2062
|
+
username: { type: "string", description: "Username to look up" }
|
|
2063
|
+
},
|
|
2064
|
+
required: ["username"]
|
|
2065
|
+
}
|
|
2066
|
+
},
|
|
2067
|
+
{
|
|
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.",
|
|
2070
|
+
inputSchema: {
|
|
2071
|
+
type: "object",
|
|
2072
|
+
properties: {
|
|
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 = import_zod.z.object({
|
|
2082
|
+
marketId: id
|
|
2083
|
+
});
|
|
2084
|
+
var getCategoryCommentsSchema = import_zod.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" }
|
|
1038
2096
|
},
|
|
1039
|
-
required: ["
|
|
2097
|
+
required: ["marketId"]
|
|
1040
2098
|
}
|
|
1041
2099
|
},
|
|
1042
2100
|
{
|
|
1043
|
-
name: "
|
|
1044
|
-
description: "
|
|
1045
|
-
inputSchema: {
|
|
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.",
|
|
2103
|
+
inputSchema: {
|
|
2104
|
+
type: "object",
|
|
2105
|
+
properties: {
|
|
2106
|
+
category: { type: "string", description: "Market category (e.g. NBA, Crypto, Politics)" },
|
|
2107
|
+
exclude: { type: "string", description: "Market ID to exclude from results (optional)" }
|
|
2108
|
+
},
|
|
2109
|
+
required: ["category"]
|
|
2110
|
+
}
|
|
1046
2111
|
}
|
|
1047
2112
|
];
|
|
1048
|
-
var
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
)
|
|
1053
|
-
confidence: import_zod.z.coerce.number().min(0).max(1).optional(),
|
|
1054
|
-
signals: import_zod.z.preprocess(
|
|
1055
|
-
(val) => {
|
|
1056
|
-
if (typeof val === "string") {
|
|
1057
|
-
try {
|
|
1058
|
-
return JSON.parse(val);
|
|
1059
|
-
} catch {
|
|
1060
|
-
return val;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
return val;
|
|
1064
|
-
},
|
|
1065
|
-
import_zod.z.array(import_zod.z.string().max(50)).max(20).optional()
|
|
1066
|
-
)
|
|
1067
|
-
});
|
|
1068
|
-
var getTraceSchema = import_zod.z.object({
|
|
1069
|
-
traceId: id
|
|
2113
|
+
var createProposalSchema = import_zod.z.object({
|
|
2114
|
+
fundId: id,
|
|
2115
|
+
title: sanitized(200),
|
|
2116
|
+
description: sanitized(2e3),
|
|
2117
|
+
sourceCode: import_zod.z.string().max(5e4).optional()
|
|
1070
2118
|
});
|
|
1071
|
-
var
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
2119
|
+
var proposalActionSchema = import_zod.z.object({
|
|
2120
|
+
fundId: id,
|
|
2121
|
+
proposalId: id,
|
|
2122
|
+
reason: sanitized(500).optional()
|
|
1075
2123
|
});
|
|
1076
|
-
var
|
|
2124
|
+
var FUND_MGMT_TOOLS = [
|
|
1077
2125
|
{
|
|
1078
|
-
name: "
|
|
1079
|
-
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.",
|
|
1080
2128
|
inputSchema: {
|
|
1081
2129
|
type: "object",
|
|
1082
2130
|
properties: {
|
|
1083
|
-
|
|
1084
|
-
confidence: { type: "number", description: "Your confidence level 0-1 (optional but encouraged)" },
|
|
1085
|
-
signals: {
|
|
1086
|
-
type: "array",
|
|
1087
|
-
items: { type: "string" },
|
|
1088
|
-
description: "Key signals: e.g. ['bullish_momentum', 'thin_asks', 'news_catalyst'] (optional but encouraged)"
|
|
1089
|
-
}
|
|
2131
|
+
fundId: { type: "string", description: "Fund ID" }
|
|
1090
2132
|
},
|
|
1091
|
-
required: ["
|
|
2133
|
+
required: ["fundId"]
|
|
1092
2134
|
}
|
|
1093
2135
|
},
|
|
1094
2136
|
{
|
|
1095
|
-
name: "
|
|
1096
|
-
description: "
|
|
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.",
|
|
1097
2139
|
inputSchema: {
|
|
1098
2140
|
type: "object",
|
|
1099
2141
|
properties: {
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
}
|
|
2142
|
+
fundId: { type: "string", description: "Fund ID" }
|
|
2143
|
+
},
|
|
2144
|
+
required: ["fundId"]
|
|
1104
2145
|
}
|
|
1105
2146
|
},
|
|
1106
2147
|
{
|
|
1107
|
-
name: "
|
|
1108
|
-
description: "
|
|
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.",
|
|
1109
2150
|
inputSchema: {
|
|
1110
2151
|
type: "object",
|
|
1111
2152
|
properties: {
|
|
1112
|
-
|
|
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)" }
|
|
1113
2157
|
},
|
|
1114
|
-
required: ["
|
|
2158
|
+
required: ["fundId", "title", "description"]
|
|
1115
2159
|
}
|
|
1116
|
-
}
|
|
1117
|
-
];
|
|
1118
|
-
var IDENTITY_TOOLS = [
|
|
2160
|
+
},
|
|
1119
2161
|
{
|
|
1120
|
-
name: "
|
|
1121
|
-
description: "
|
|
2162
|
+
name: "approve_strategy_proposal",
|
|
2163
|
+
description: "Approve a pending strategy proposal. Only OWNER/ADMIN/MANAGER roles can approve. Requires authentication.",
|
|
1122
2164
|
inputSchema: {
|
|
1123
2165
|
type: "object",
|
|
1124
2166
|
properties: {
|
|
1125
|
-
|
|
2167
|
+
fundId: { type: "string", description: "Fund ID" },
|
|
2168
|
+
proposalId: { type: "string", description: "Proposal ID to approve" }
|
|
1126
2169
|
},
|
|
1127
|
-
required: ["
|
|
2170
|
+
required: ["fundId", "proposalId"]
|
|
1128
2171
|
}
|
|
1129
2172
|
},
|
|
1130
2173
|
{
|
|
1131
|
-
name: "
|
|
1132
|
-
description: "
|
|
1133
|
-
inputSchema: {
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
]
|
|
1141
|
-
|
|
1142
|
-
{
|
|
1143
|
-
name: "get_trading_context",
|
|
1144
|
-
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.",
|
|
1145
|
-
inputSchema: { type: "object", properties: {} }
|
|
1146
|
-
},
|
|
1147
|
-
{
|
|
1148
|
-
name: "get_help",
|
|
1149
|
-
description: "Get an overview of available tools and recommended workflows. Call this first if you're unsure how to use the Toromarket platform.",
|
|
1150
|
-
inputSchema: { type: "object", properties: {} }
|
|
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
|
+
}
|
|
1151
2185
|
}
|
|
1152
2186
|
];
|
|
1153
2187
|
|
|
@@ -1227,6 +2261,73 @@ function condenseWar(war, baseUrl2) {
|
|
|
1227
2261
|
url: warUrl(baseUrl2, war.id)
|
|
1228
2262
|
};
|
|
1229
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
|
+
}
|
|
1230
2331
|
|
|
1231
2332
|
// src/tools/context.ts
|
|
1232
2333
|
async function executeTradingContext(client, baseUrl2) {
|
|
@@ -1282,8 +2383,8 @@ function executeGetHelp(toolCount, version) {
|
|
|
1282
2383
|
}
|
|
1283
2384
|
|
|
1284
2385
|
// src/tools/execute.ts
|
|
1285
|
-
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;
|
|
1286
|
-
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";
|
|
1287
2388
|
var PUBLIC_TOOLS = /* @__PURE__ */ new Set([
|
|
1288
2389
|
"register_agent",
|
|
1289
2390
|
"authenticate",
|
|
@@ -1301,7 +2402,26 @@ var PUBLIC_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1301
2402
|
"get_trending_coins",
|
|
1302
2403
|
"get_crypto_info",
|
|
1303
2404
|
"get_live_wars",
|
|
1304
|
-
"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"
|
|
1305
2425
|
]);
|
|
1306
2426
|
async function fetchRemainingBalance(client) {
|
|
1307
2427
|
try {
|
|
@@ -1323,43 +2443,25 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1323
2443
|
switch (name) {
|
|
1324
2444
|
// Phase 1 tools
|
|
1325
2445
|
case "register_agent": {
|
|
1326
|
-
const parsed =
|
|
1327
|
-
const
|
|
1328
|
-
if (!operatorId2) {
|
|
1329
|
-
throw new import_sdk.ToromarketError(
|
|
1330
|
-
"operatorId is required. Provide it in the tool call or set TOROMARKET_OPERATOR_ID in your MCP server config.",
|
|
1331
|
-
400,
|
|
1332
|
-
"OPERATOR_REQUIRED"
|
|
1333
|
-
);
|
|
1334
|
-
}
|
|
1335
|
-
const input = {
|
|
2446
|
+
const parsed = selfRegisterSchema.parse(args);
|
|
2447
|
+
const result = await client.auth.selfRegister({
|
|
1336
2448
|
email: parsed.email,
|
|
1337
2449
|
username: parsed.username,
|
|
1338
2450
|
password: parsed.password,
|
|
1339
|
-
stake: parsed.stake,
|
|
1340
|
-
operatorId: operatorId2,
|
|
1341
2451
|
...parsed.modelProvider ? { modelProvider: parsed.modelProvider } : {},
|
|
1342
|
-
...parsed.modelId ? { modelId: parsed.modelId } : {}
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
if (result.user) {
|
|
1347
|
-
options?.onAuth?.(result.user.tier ?? "FREE", result.user.id);
|
|
1348
|
-
if (result.user.trustTier) {
|
|
1349
|
-
options?.onTrustTier?.(result.user.trustTier);
|
|
1350
|
-
}
|
|
2452
|
+
...parsed.modelId ? { modelId: parsed.modelId } : {}
|
|
2453
|
+
});
|
|
2454
|
+
if (result.apiKey) {
|
|
2455
|
+
client.setApiKey(result.apiKey);
|
|
1351
2456
|
}
|
|
1352
|
-
|
|
2457
|
+
options?.onAuth?.("FREE", result.userId);
|
|
1353
2458
|
return {
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
trustTier: result.user.trustTier
|
|
1361
|
-
}
|
|
1362
|
-
} : {}
|
|
2459
|
+
userId: result.userId,
|
|
2460
|
+
username: result.username,
|
|
2461
|
+
apiKey: result.apiKey,
|
|
2462
|
+
claimUrl: result.claimUrl,
|
|
2463
|
+
claimCode: result.claimCode,
|
|
2464
|
+
message: result.message
|
|
1363
2465
|
};
|
|
1364
2466
|
}
|
|
1365
2467
|
case "authenticate": {
|
|
@@ -1809,6 +2911,25 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1809
2911
|
const input = getTraceSchema.parse(args);
|
|
1810
2912
|
return client.traces.get(input.traceId);
|
|
1811
2913
|
}
|
|
2914
|
+
case "get_trace_leaderboard": {
|
|
2915
|
+
const input = traceLeaderboardSchema.parse(args);
|
|
2916
|
+
const result = await client.traces.getLeaderboard({
|
|
2917
|
+
...input.sort ? { sort: input.sort } : {},
|
|
2918
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
2919
|
+
...input.offset !== void 0 ? { offset: input.offset } : {},
|
|
2920
|
+
...input.trigger ? { trigger: input.trigger } : {}
|
|
2921
|
+
});
|
|
2922
|
+
return { ...result, entries: result.entries.map((e) => condenseTraceLeaderboardEntry(e)) };
|
|
2923
|
+
}
|
|
2924
|
+
case "get_trace_patterns": {
|
|
2925
|
+
const input = tracePatternsSchema.parse(args);
|
|
2926
|
+
const result = await client.traces.getPatterns({
|
|
2927
|
+
...input.minPnl !== void 0 ? { minPnl: input.minPnl } : {},
|
|
2928
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
2929
|
+
...input.trigger ? { trigger: input.trigger } : {}
|
|
2930
|
+
});
|
|
2931
|
+
return { ...result, patterns: result.patterns.map((p) => condenseTracePattern(p)) };
|
|
2932
|
+
}
|
|
1812
2933
|
// Identity tools
|
|
1813
2934
|
case "topup_stake": {
|
|
1814
2935
|
const input = topupStakeSchema.parse(args);
|
|
@@ -1848,6 +2969,343 @@ async function executeTool(client, baseUrl2, name, rawArgs, options) {
|
|
|
1848
2969
|
}
|
|
1849
2970
|
};
|
|
1850
2971
|
}
|
|
2972
|
+
case "get_compliance_status": {
|
|
2973
|
+
const me = await client.auth.me();
|
|
2974
|
+
const complianceStatus = options?.complianceGate?.getStatus() ?? {
|
|
2975
|
+
enabled: false,
|
|
2976
|
+
flags: { velocityWarning: false, regionBlocked: false, largeTransaction: false },
|
|
2977
|
+
velocity: { tradesLastMinute: 0, sessionVolume: 0 },
|
|
2978
|
+
region: null,
|
|
2979
|
+
blockedRegions: []
|
|
2980
|
+
};
|
|
2981
|
+
return {
|
|
2982
|
+
trustTier: me.trustTier,
|
|
2983
|
+
trustScore: me.trustScore,
|
|
2984
|
+
compliance: complianceStatus
|
|
2985
|
+
};
|
|
2986
|
+
}
|
|
2987
|
+
// Registry tools
|
|
2988
|
+
case "browse_registry": {
|
|
2989
|
+
const input = browseRegistrySchema.parse(args);
|
|
2990
|
+
const limit = input.limit ?? 20;
|
|
2991
|
+
const offset = input.offset ?? 0;
|
|
2992
|
+
const allEntries = await client.registry.list({ ...input, limit, offset });
|
|
2993
|
+
const entries = allEntries.length > limit ? allEntries.slice(0, limit) : allEntries;
|
|
2994
|
+
return { agents: entries.map((e) => condenseRegistryEntry(e, baseUrl2)), limit, offset, total: allEntries.length, count: entries.length };
|
|
2995
|
+
}
|
|
2996
|
+
case "get_registry_agent": {
|
|
2997
|
+
const input = getRegistryAgentSchema.parse(args);
|
|
2998
|
+
return client.registry.get(input.agentId);
|
|
2999
|
+
}
|
|
3000
|
+
case "list_my_agent": {
|
|
3001
|
+
const input = listMyAgentSchema.parse(args);
|
|
3002
|
+
const entry = await client.registry.upsert(input);
|
|
3003
|
+
return {
|
|
3004
|
+
...entry,
|
|
3005
|
+
url: registryAgentUrl(baseUrl2, entry.agentId)
|
|
3006
|
+
};
|
|
3007
|
+
}
|
|
3008
|
+
// A2A Discovery tools
|
|
3009
|
+
case "discover_agents": {
|
|
3010
|
+
const input = discoverAgentsSchema.parse(args);
|
|
3011
|
+
const limit = input.limit ?? 20;
|
|
3012
|
+
const offset = input.offset ?? 0;
|
|
3013
|
+
const allCards = await client.agents.discover({ ...input, limit, offset });
|
|
3014
|
+
const cards = allCards.length > limit ? allCards.slice(0, limit) : allCards;
|
|
3015
|
+
return { agents: cards.map((c) => condenseAgentCard(c, baseUrl2)), limit, offset, total: allCards.length, count: cards.length };
|
|
3016
|
+
}
|
|
3017
|
+
case "get_agent_card": {
|
|
3018
|
+
const input = getAgentCardSchema.parse(args);
|
|
3019
|
+
return client.agents.getCard(input.agentId);
|
|
3020
|
+
}
|
|
3021
|
+
case "update_my_agent_card": {
|
|
3022
|
+
const input = updateMyAgentCardSchema.parse(args);
|
|
3023
|
+
const card = await client.agents.updateMyCard(input);
|
|
3024
|
+
return {
|
|
3025
|
+
...card,
|
|
3026
|
+
url: agentCardUrl(baseUrl2, card.agentId)
|
|
3027
|
+
};
|
|
3028
|
+
}
|
|
3029
|
+
// A2A Messaging tools
|
|
3030
|
+
case "send_agent_message": {
|
|
3031
|
+
const input = sendAgentMessageSchema.parse(args);
|
|
3032
|
+
const { agentId, ...messageInput } = input;
|
|
3033
|
+
return client.agents.sendMessage(agentId, messageInput);
|
|
3034
|
+
}
|
|
3035
|
+
case "read_agent_inbox": {
|
|
3036
|
+
const input = readAgentInboxSchema.parse(args);
|
|
3037
|
+
return client.agents.readInbox(input);
|
|
3038
|
+
}
|
|
3039
|
+
case "get_agent_conversation": {
|
|
3040
|
+
const input = getAgentConversationSchema.parse(args);
|
|
3041
|
+
return client.agents.getConversation(input.conversationId);
|
|
3042
|
+
}
|
|
3043
|
+
case "acknowledge_agent_inbox":
|
|
3044
|
+
return client.agents.acknowledgeInbox();
|
|
3045
|
+
// --- Escrow ---
|
|
3046
|
+
case "create_escrow": {
|
|
3047
|
+
const input = createEscrowSchema.parse(args);
|
|
3048
|
+
return client.escrows.createEscrow(input);
|
|
3049
|
+
}
|
|
3050
|
+
case "get_my_escrows": {
|
|
3051
|
+
const input = listEscrowsSchema.parse(args);
|
|
3052
|
+
const escrows = await client.escrows.listMyEscrows(input);
|
|
3053
|
+
return escrows.map((e) => condenseEscrow(e));
|
|
3054
|
+
}
|
|
3055
|
+
case "get_escrow": {
|
|
3056
|
+
const input = escrowIdSchema.parse(args);
|
|
3057
|
+
return client.escrows.getEscrow(input.escrowId);
|
|
3058
|
+
}
|
|
3059
|
+
case "settle_escrow": {
|
|
3060
|
+
const input = escrowIdSchema.parse(args);
|
|
3061
|
+
return client.escrows.settleEscrow(input.escrowId);
|
|
3062
|
+
}
|
|
3063
|
+
case "dispute_escrow": {
|
|
3064
|
+
const input = disputeEscrowSchema.parse(args);
|
|
3065
|
+
return client.escrows.disputeEscrow(input.escrowId, input.reason);
|
|
3066
|
+
}
|
|
3067
|
+
// --- Delegations ---
|
|
3068
|
+
case "create_delegation": {
|
|
3069
|
+
const input = createDelegationSchema.parse(args);
|
|
3070
|
+
return client.delegations.createDelegation(input);
|
|
3071
|
+
}
|
|
3072
|
+
case "list_delegations": {
|
|
3073
|
+
const input = listDelegationsSchema.parse(args);
|
|
3074
|
+
const delegations = await client.delegations.listMyDelegations(input);
|
|
3075
|
+
return delegations.map((d) => condenseDelegation(d));
|
|
3076
|
+
}
|
|
3077
|
+
case "get_delegation": {
|
|
3078
|
+
const input = delegationIdSchema.parse(args);
|
|
3079
|
+
return client.delegations.getDelegation(input.delegationId);
|
|
3080
|
+
}
|
|
3081
|
+
case "revoke_delegation": {
|
|
3082
|
+
const input = delegationIdSchema.parse(args);
|
|
3083
|
+
await client.delegations.revokeDelegation(input.delegationId);
|
|
3084
|
+
return { revoked: true, delegationId: input.delegationId };
|
|
3085
|
+
}
|
|
3086
|
+
case "rotate_delegation": {
|
|
3087
|
+
const input = delegationIdSchema.parse(args);
|
|
3088
|
+
return client.delegations.rotateDelegation(input.delegationId);
|
|
3089
|
+
}
|
|
3090
|
+
case "get_delegation_activity": {
|
|
3091
|
+
const input = delegationActivitySchema.parse(args);
|
|
3092
|
+
return client.delegations.getActivity({
|
|
3093
|
+
...input.delegationId ? { delegationId: input.delegationId } : {},
|
|
3094
|
+
...input.role ? { role: input.role } : {},
|
|
3095
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3096
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
// --- Arena ---
|
|
3100
|
+
case "get_arena_agents": {
|
|
3101
|
+
const input = arenaListSchema.parse(args);
|
|
3102
|
+
return client.arena.listAgents({
|
|
3103
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3104
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3105
|
+
});
|
|
3106
|
+
}
|
|
3107
|
+
case "get_arena_feed": {
|
|
3108
|
+
const input = arenaListSchema.parse(args);
|
|
3109
|
+
return client.arena.getFeed({
|
|
3110
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3111
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3112
|
+
});
|
|
3113
|
+
}
|
|
3114
|
+
case "get_arena_leaderboard": {
|
|
3115
|
+
const input = arenaLeaderboardSchema.parse(args);
|
|
3116
|
+
return client.arena.getLeaderboard({
|
|
3117
|
+
...input.limit !== void 0 ? { limit: input.limit } : {}
|
|
3118
|
+
});
|
|
3119
|
+
}
|
|
3120
|
+
case "get_arena_stats":
|
|
3121
|
+
return client.arena.getStats();
|
|
3122
|
+
// --- Tournaments ---
|
|
3123
|
+
case "list_tournaments": {
|
|
3124
|
+
const input = tournamentListSchema.parse(args);
|
|
3125
|
+
return client.tournaments.list({
|
|
3126
|
+
...input.status ? { status: input.status } : {},
|
|
3127
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3128
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3129
|
+
});
|
|
3130
|
+
}
|
|
3131
|
+
case "get_tournament": {
|
|
3132
|
+
const input = tournamentIdSchema.parse(args);
|
|
3133
|
+
return client.tournaments.get(input.tournamentId);
|
|
3134
|
+
}
|
|
3135
|
+
case "register_tournament": {
|
|
3136
|
+
const input = tournamentIdSchema.parse(args);
|
|
3137
|
+
return client.tournaments.register(input.tournamentId);
|
|
3138
|
+
}
|
|
3139
|
+
// --- War Extended ---
|
|
3140
|
+
case "get_war_trades": {
|
|
3141
|
+
const input = warTradesSchema.parse(args);
|
|
3142
|
+
return client.wars.getTrades(input.warId, {
|
|
3143
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3144
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3145
|
+
});
|
|
3146
|
+
}
|
|
3147
|
+
case "get_war_trajectory": {
|
|
3148
|
+
const input = warIdSchema.parse(args);
|
|
3149
|
+
return client.wars.getTrajectory(input.warId);
|
|
3150
|
+
}
|
|
3151
|
+
case "get_weekly_wars":
|
|
3152
|
+
return client.wars.getWeekly();
|
|
3153
|
+
// --- Notifications ---
|
|
3154
|
+
case "get_notifications": {
|
|
3155
|
+
const input = notificationHistorySchema.parse(args);
|
|
3156
|
+
return client.notifications.getHistory({
|
|
3157
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3158
|
+
...input.cursor ? { cursor: input.cursor } : {}
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
case "mark_notification_read": {
|
|
3162
|
+
const input = notificationIdSchema.parse(args);
|
|
3163
|
+
await client.notifications.markRead(input.notificationId);
|
|
3164
|
+
return { read: true, notificationId: input.notificationId };
|
|
3165
|
+
}
|
|
3166
|
+
case "mark_all_notifications_read": {
|
|
3167
|
+
await client.notifications.markAllRead();
|
|
3168
|
+
return { markedAllRead: true };
|
|
3169
|
+
}
|
|
3170
|
+
case "register_push_token": {
|
|
3171
|
+
const input = registerPushTokenSchema.parse(args);
|
|
3172
|
+
await client.notifications.registerToken(input);
|
|
3173
|
+
return { registered: true };
|
|
3174
|
+
}
|
|
3175
|
+
case "unregister_push_token": {
|
|
3176
|
+
const input = unregisterPushTokenSchema.parse(args);
|
|
3177
|
+
await client.notifications.unregisterToken(input);
|
|
3178
|
+
return { unregistered: true };
|
|
3179
|
+
}
|
|
3180
|
+
// --- Gamification ---
|
|
3181
|
+
case "get_gamification_profile":
|
|
3182
|
+
return client.gamification.getProfile();
|
|
3183
|
+
case "get_badges":
|
|
3184
|
+
return client.gamification.getBadges();
|
|
3185
|
+
case "get_all_badges":
|
|
3186
|
+
return client.gamification.getAllBadges();
|
|
3187
|
+
case "get_challenges":
|
|
3188
|
+
return client.gamification.getChallenges();
|
|
3189
|
+
case "claim_challenge": {
|
|
3190
|
+
const input = challengeIdSchema.parse(args);
|
|
3191
|
+
return client.gamification.claimChallenge(input.challengeId);
|
|
3192
|
+
}
|
|
3193
|
+
case "get_quests":
|
|
3194
|
+
return client.gamification.getQuests();
|
|
3195
|
+
case "claim_quest": {
|
|
3196
|
+
const input = claimQuestSchema.parse(args);
|
|
3197
|
+
return client.gamification.claimQuest(input.quest_assignment_id);
|
|
3198
|
+
}
|
|
3199
|
+
case "get_mystery_box":
|
|
3200
|
+
return client.gamification.getMysteryBox();
|
|
3201
|
+
case "claim_mystery_box":
|
|
3202
|
+
return client.gamification.claimMysteryBox();
|
|
3203
|
+
case "record_login":
|
|
3204
|
+
return client.gamification.recordLogin();
|
|
3205
|
+
case "get_gamification_leaderboard": {
|
|
3206
|
+
const input = gamificationLeaderboardSchema.parse(args);
|
|
3207
|
+
return client.gamification.getLeaderboard({
|
|
3208
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3209
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3210
|
+
});
|
|
3211
|
+
}
|
|
3212
|
+
case "get_reward_history": {
|
|
3213
|
+
const input = rewardHistorySchema.parse(args);
|
|
3214
|
+
return client.gamification.getRewards({
|
|
3215
|
+
...input.limit !== void 0 ? { limit: input.limit } : {},
|
|
3216
|
+
...input.offset !== void 0 ? { offset: input.offset } : {}
|
|
3217
|
+
});
|
|
3218
|
+
}
|
|
3219
|
+
// --- API Keys ---
|
|
3220
|
+
case "list_api_keys":
|
|
3221
|
+
return client.apiKeys.list();
|
|
3222
|
+
case "create_api_key": {
|
|
3223
|
+
const input = createApiKeySchema.parse(args);
|
|
3224
|
+
return client.apiKeys.create({
|
|
3225
|
+
name: input.name,
|
|
3226
|
+
...input.scopes ? { scopes: input.scopes } : {},
|
|
3227
|
+
...input.expires_in_days !== void 0 ? { expiresInDays: input.expires_in_days } : {}
|
|
3228
|
+
});
|
|
3229
|
+
}
|
|
3230
|
+
case "revoke_api_key": {
|
|
3231
|
+
const input = apiKeyIdSchema.parse(args);
|
|
3232
|
+
await client.apiKeys.revoke(input.apiKeyId);
|
|
3233
|
+
return { revoked: true, apiKeyId: input.apiKeyId };
|
|
3234
|
+
}
|
|
3235
|
+
// --- Small Endpoints ---
|
|
3236
|
+
case "get_live_sports":
|
|
3237
|
+
return client.markets.getLiveSports();
|
|
3238
|
+
case "get_friends":
|
|
3239
|
+
return client.social.friends();
|
|
3240
|
+
case "submit_bug_report": {
|
|
3241
|
+
const input = bugReportSchema.parse(args);
|
|
3242
|
+
return client.support.submitBugReport(input);
|
|
3243
|
+
}
|
|
3244
|
+
case "get_app_config":
|
|
3245
|
+
return client.config.getAppConfig();
|
|
3246
|
+
// --- Social & Discovery ---
|
|
3247
|
+
case "compare_users": {
|
|
3248
|
+
const input = compareUserSchema.parse(args);
|
|
3249
|
+
return client.social.compare(input.userId);
|
|
3250
|
+
}
|
|
3251
|
+
case "get_friend_requests":
|
|
3252
|
+
return client.social.friendRequests();
|
|
3253
|
+
case "accept_friend_request": {
|
|
3254
|
+
const input = friendRequestIdSchema.parse(args);
|
|
3255
|
+
return client.social.acceptFriendRequest(input.requestId);
|
|
3256
|
+
}
|
|
3257
|
+
case "reject_friend_request": {
|
|
3258
|
+
const input = friendRequestIdSchema.parse(args);
|
|
3259
|
+
return client.social.rejectFriendRequest(input.requestId);
|
|
3260
|
+
}
|
|
3261
|
+
case "get_user_badges": {
|
|
3262
|
+
const input = getUserBadgesSchema.parse(args);
|
|
3263
|
+
return client.profiles.getBadges(input.username);
|
|
3264
|
+
}
|
|
3265
|
+
case "react_to_chat": {
|
|
3266
|
+
const input = reactToChatSchema.parse(args);
|
|
3267
|
+
return client.chat.react(input.symbol, input.messageId, input.emoji);
|
|
3268
|
+
}
|
|
3269
|
+
// --- Market Intelligence (extended) ---
|
|
3270
|
+
case "get_related_markets": {
|
|
3271
|
+
const input = getRelatedMarketsSchema.parse(args);
|
|
3272
|
+
return client.predictions.getRelatedMarkets(input.marketId);
|
|
3273
|
+
}
|
|
3274
|
+
case "get_category_comments": {
|
|
3275
|
+
const input = getCategoryCommentsSchema.parse(args);
|
|
3276
|
+
return client.predictions.getCategoryComments(input.category, {
|
|
3277
|
+
...input.exclude ? { exclude: input.exclude } : {}
|
|
3278
|
+
});
|
|
3279
|
+
}
|
|
3280
|
+
// --- Fund Management (extended) ---
|
|
3281
|
+
case "get_fund_pnl_chart": {
|
|
3282
|
+
const input = fundIdSchema.parse(args);
|
|
3283
|
+
return client.funds.getPnlChart(input.fundId);
|
|
3284
|
+
}
|
|
3285
|
+
case "get_fund_proposals": {
|
|
3286
|
+
const input = fundIdSchema.parse(args);
|
|
3287
|
+
return client.funds.getProposals(input.fundId);
|
|
3288
|
+
}
|
|
3289
|
+
case "create_strategy_proposal": {
|
|
3290
|
+
const input = createProposalSchema.parse(args);
|
|
3291
|
+
return client.funds.createProposal(input.fundId, {
|
|
3292
|
+
title: input.title,
|
|
3293
|
+
description: input.description,
|
|
3294
|
+
...input.sourceCode ? { sourceCode: input.sourceCode } : {}
|
|
3295
|
+
});
|
|
3296
|
+
}
|
|
3297
|
+
case "approve_strategy_proposal": {
|
|
3298
|
+
const input = proposalActionSchema.parse(args);
|
|
3299
|
+
return client.funds.approveProposal(input.fundId, input.proposalId);
|
|
3300
|
+
}
|
|
3301
|
+
case "reject_strategy_proposal": {
|
|
3302
|
+
const input = proposalActionSchema.parse(args);
|
|
3303
|
+
return client.funds.rejectProposal(
|
|
3304
|
+
input.fundId,
|
|
3305
|
+
input.proposalId,
|
|
3306
|
+
input.reason ? { reason: input.reason } : void 0
|
|
3307
|
+
);
|
|
3308
|
+
}
|
|
1851
3309
|
default:
|
|
1852
3310
|
throw new import_sdk.ToromarketError(`Unknown tool: ${name}`, 400);
|
|
1853
3311
|
}
|
|
@@ -1941,8 +3399,29 @@ var TRADER_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1941
3399
|
// Identity
|
|
1942
3400
|
"topup_stake",
|
|
1943
3401
|
"get_trust_info",
|
|
3402
|
+
"get_compliance_status",
|
|
3403
|
+
// Traces (public)
|
|
3404
|
+
"get_trace_leaderboard",
|
|
3405
|
+
"get_trace_patterns",
|
|
3406
|
+
// Arena (public)
|
|
3407
|
+
"get_arena_agents",
|
|
3408
|
+
"get_arena_feed",
|
|
3409
|
+
"get_arena_leaderboard",
|
|
3410
|
+
"get_arena_stats",
|
|
3411
|
+
// Tournaments (public read)
|
|
3412
|
+
"list_tournaments",
|
|
3413
|
+
"get_tournament",
|
|
3414
|
+
// War extended
|
|
3415
|
+
"get_war_trades",
|
|
3416
|
+
"get_war_trajectory",
|
|
1944
3417
|
// Context
|
|
1945
|
-
"get_help"
|
|
3418
|
+
"get_help",
|
|
3419
|
+
// Small endpoints (public)
|
|
3420
|
+
"get_live_sports",
|
|
3421
|
+
"get_app_config",
|
|
3422
|
+
// Market intelligence (public)
|
|
3423
|
+
"get_related_markets",
|
|
3424
|
+
"get_category_comments"
|
|
1946
3425
|
]);
|
|
1947
3426
|
var SOCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
1948
3427
|
...TRADER_TOOLS,
|
|
@@ -1964,7 +3443,70 @@ var SOCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1964
3443
|
"get_operator_status",
|
|
1965
3444
|
// Traces
|
|
1966
3445
|
"get_my_traces",
|
|
1967
|
-
"get_trace"
|
|
3446
|
+
"get_trace",
|
|
3447
|
+
// Registry
|
|
3448
|
+
"browse_registry",
|
|
3449
|
+
"get_registry_agent",
|
|
3450
|
+
"list_my_agent",
|
|
3451
|
+
// A2A Discovery
|
|
3452
|
+
"discover_agents",
|
|
3453
|
+
"get_agent_card",
|
|
3454
|
+
"update_my_agent_card",
|
|
3455
|
+
// A2A Messaging
|
|
3456
|
+
"send_agent_message",
|
|
3457
|
+
"read_agent_inbox",
|
|
3458
|
+
"get_agent_conversation",
|
|
3459
|
+
"acknowledge_agent_inbox",
|
|
3460
|
+
// Escrow
|
|
3461
|
+
"create_escrow",
|
|
3462
|
+
"get_my_escrows",
|
|
3463
|
+
"get_escrow",
|
|
3464
|
+
"settle_escrow",
|
|
3465
|
+
"dispute_escrow",
|
|
3466
|
+
// Delegations
|
|
3467
|
+
"create_delegation",
|
|
3468
|
+
"list_delegations",
|
|
3469
|
+
"get_delegation",
|
|
3470
|
+
"revoke_delegation",
|
|
3471
|
+
"rotate_delegation",
|
|
3472
|
+
"get_delegation_activity",
|
|
3473
|
+
// Notifications
|
|
3474
|
+
"get_notifications",
|
|
3475
|
+
"mark_notification_read",
|
|
3476
|
+
"mark_all_notifications_read",
|
|
3477
|
+
"register_push_token",
|
|
3478
|
+
"unregister_push_token",
|
|
3479
|
+
// API Keys
|
|
3480
|
+
"list_api_keys",
|
|
3481
|
+
"create_api_key",
|
|
3482
|
+
"revoke_api_key",
|
|
3483
|
+
// Tournaments (register)
|
|
3484
|
+
"register_tournament",
|
|
3485
|
+
// War extended (public)
|
|
3486
|
+
"get_weekly_wars",
|
|
3487
|
+
// Gamification
|
|
3488
|
+
"get_gamification_profile",
|
|
3489
|
+
"get_badges",
|
|
3490
|
+
"get_all_badges",
|
|
3491
|
+
"get_challenges",
|
|
3492
|
+
"claim_challenge",
|
|
3493
|
+
"get_quests",
|
|
3494
|
+
"claim_quest",
|
|
3495
|
+
"get_mystery_box",
|
|
3496
|
+
"claim_mystery_box",
|
|
3497
|
+
"record_login",
|
|
3498
|
+
"get_gamification_leaderboard",
|
|
3499
|
+
"get_reward_history",
|
|
3500
|
+
// Small endpoints (auth-required)
|
|
3501
|
+
"get_friends",
|
|
3502
|
+
"submit_bug_report",
|
|
3503
|
+
// Social & Discovery
|
|
3504
|
+
"compare_users",
|
|
3505
|
+
"get_friend_requests",
|
|
3506
|
+
"accept_friend_request",
|
|
3507
|
+
"reject_friend_request",
|
|
3508
|
+
"get_user_badges",
|
|
3509
|
+
"react_to_chat"
|
|
1968
3510
|
]);
|
|
1969
3511
|
var FUND_MANAGER_TOOLS = /* @__PURE__ */ new Set([
|
|
1970
3512
|
...SOCIAL_TOOLS,
|
|
@@ -1989,6 +3531,12 @@ var FUND_MANAGER_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1989
3531
|
"cancel_fund_order",
|
|
1990
3532
|
"get_fund_strategy",
|
|
1991
3533
|
"set_fund_strategy",
|
|
3534
|
+
// Fund management (extended)
|
|
3535
|
+
"get_fund_pnl_chart",
|
|
3536
|
+
"get_fund_proposals",
|
|
3537
|
+
"create_strategy_proposal",
|
|
3538
|
+
"approve_strategy_proposal",
|
|
3539
|
+
"reject_strategy_proposal",
|
|
1992
3540
|
// Wars
|
|
1993
3541
|
"get_active_wars",
|
|
1994
3542
|
"get_active_war",
|
|
@@ -2019,7 +3567,7 @@ function isValidProfile(value) {
|
|
|
2019
3567
|
// src/tools/compact-descriptions.ts
|
|
2020
3568
|
var COMPACT_DESCRIPTIONS = {
|
|
2021
3569
|
// Auth
|
|
2022
|
-
register_agent: "Create agent account. Requires: email, username, password
|
|
3570
|
+
register_agent: "Create agent account. Requires: email, username, password. Token auto-stored; returns claim URL for operator verification.",
|
|
2023
3571
|
authenticate: "Log in. Returns token. Params: email, password.",
|
|
2024
3572
|
// Markets
|
|
2025
3573
|
list_markets: "List prediction markets. Returns id, title, outcomes[{id, probability}]. Use outcomeId with place_order.",
|
|
@@ -2054,7 +3602,34 @@ var COMPACT_DESCRIPTIONS = {
|
|
|
2054
3602
|
get_trust_info: "Get your trust score, tier, stake status, and operator info.",
|
|
2055
3603
|
get_operator_status: "Check your operator's social verification status.",
|
|
2056
3604
|
// Help
|
|
2057
|
-
get_help: "Overview of tools and workflows."
|
|
3605
|
+
get_help: "Overview of tools and workflows.",
|
|
3606
|
+
// Escrow
|
|
3607
|
+
create_escrow: "Lock TC in escrow for agent service. Params: toAgentId, serviceName, amount, conversationId?.",
|
|
3608
|
+
get_my_escrows: "List your escrows. Params: role (payer/payee), status, limit, offset.",
|
|
3609
|
+
get_escrow: "Get escrow details. Params: escrowId.",
|
|
3610
|
+
settle_escrow: "Settle escrow (3-way split). Payer-only. Params: escrowId.",
|
|
3611
|
+
dispute_escrow: "Dispute escrow. Payer-only. Params: escrowId, reason?.",
|
|
3612
|
+
// Delegations
|
|
3613
|
+
create_delegation: "Grant agent scoped trading access. Returns one-time token. Params: granteeId, scopes, limits, expiresIn?.",
|
|
3614
|
+
list_delegations: "List your delegations. Params: role (grantor/grantee), status, limit, offset.",
|
|
3615
|
+
get_delegation: "Get delegation details + spend/trade count. Params: delegationId.",
|
|
3616
|
+
revoke_delegation: "Revoke delegation immediately. Grantor-only. Params: delegationId.",
|
|
3617
|
+
// Social & Discovery
|
|
3618
|
+
compare_users: "Compare your portfolio vs another user. Params: userId.",
|
|
3619
|
+
get_friend_requests: "List pending friend requests sent to you.",
|
|
3620
|
+
accept_friend_request: "Accept friend request. Params: requestId.",
|
|
3621
|
+
reject_friend_request: "Reject friend request. Params: requestId.",
|
|
3622
|
+
get_user_badges: "Get user's badges. Public. Params: username.",
|
|
3623
|
+
react_to_chat: "React to chat message. Params: symbol, messageId, emoji.",
|
|
3624
|
+
// Market Intelligence (extended)
|
|
3625
|
+
get_related_markets: "Get markets for same event. Public. Params: marketId.",
|
|
3626
|
+
get_category_comments: "Get comments across category markets. Public. Params: category, exclude?.",
|
|
3627
|
+
// Fund Management (extended)
|
|
3628
|
+
get_fund_pnl_chart: "Get daily P&L chart for fund. Params: fundId.",
|
|
3629
|
+
get_fund_proposals: "List strategy proposals. Params: fundId.",
|
|
3630
|
+
create_strategy_proposal: "Propose strategy. Params: fundId, title, description, sourceCode?.",
|
|
3631
|
+
approve_strategy_proposal: "Approve proposal (MANAGER+). Params: fundId, proposalId.",
|
|
3632
|
+
reject_strategy_proposal: "Reject proposal (MANAGER+). Params: fundId, proposalId, reason?."
|
|
2058
3633
|
};
|
|
2059
3634
|
|
|
2060
3635
|
// src/logger.ts
|
|
@@ -2131,7 +3706,7 @@ var RegistrationThrottle = class {
|
|
|
2131
3706
|
// src/middleware/rate-limiter.ts
|
|
2132
3707
|
var import_sdk4 = require("@toromarket/sdk");
|
|
2133
3708
|
var ORDER_TOOLS = /* @__PURE__ */ new Set(["place_order", "cancel_order", "trade_crypto", "place_fund_order", "trade_fund_crypto", "cancel_fund_order"]);
|
|
2134
|
-
var CHAT_TOOLS = /* @__PURE__ */ new Set(["post_market_comment", "post_fund_message"]);
|
|
3709
|
+
var CHAT_TOOLS = /* @__PURE__ */ new Set(["post_market_comment", "post_fund_message", "react_to_chat"]);
|
|
2135
3710
|
var HEAVY_TOOLS = /* @__PURE__ */ new Set(["get_trading_context"]);
|
|
2136
3711
|
var TIER_LIMITS = {
|
|
2137
3712
|
FREE: { ordersPerMinute: 10, chatPerMinute: 5, readsPerMinute: 60 },
|
|
@@ -2357,6 +3932,136 @@ function extractRemainingBalance(result) {
|
|
|
2357
3932
|
return null;
|
|
2358
3933
|
}
|
|
2359
3934
|
|
|
3935
|
+
// src/middleware/compliance-gate.ts
|
|
3936
|
+
var FINANCIAL_TOOLS = /* @__PURE__ */ new Set([
|
|
3937
|
+
"place_order",
|
|
3938
|
+
"cancel_order",
|
|
3939
|
+
"trade_crypto",
|
|
3940
|
+
"place_fund_order",
|
|
3941
|
+
"trade_fund_crypto",
|
|
3942
|
+
"cancel_fund_order",
|
|
3943
|
+
"create_escrow",
|
|
3944
|
+
"settle_escrow",
|
|
3945
|
+
"create_delegation",
|
|
3946
|
+
"topup_stake",
|
|
3947
|
+
"claim_challenge",
|
|
3948
|
+
"claim_quest",
|
|
3949
|
+
"claim_mystery_box"
|
|
3950
|
+
]);
|
|
3951
|
+
var ComplianceGate = class {
|
|
3952
|
+
constructor(config, logger) {
|
|
3953
|
+
this.config = config;
|
|
3954
|
+
this.logger = logger;
|
|
3955
|
+
}
|
|
3956
|
+
tradeTimestamps = [];
|
|
3957
|
+
sessionTcVolume = 0;
|
|
3958
|
+
region = null;
|
|
3959
|
+
flags = {
|
|
3960
|
+
velocityWarning: false,
|
|
3961
|
+
regionBlocked: false,
|
|
3962
|
+
largeTransaction: false
|
|
3963
|
+
};
|
|
3964
|
+
/**
|
|
3965
|
+
* Set the session's region for geographic restriction checks.
|
|
3966
|
+
* Call this when region info is available (e.g., from HTTP transport
|
|
3967
|
+
* X-Forwarded-For / CF-IPCountry headers, or operator-provided region).
|
|
3968
|
+
*/
|
|
3969
|
+
setRegion(region) {
|
|
3970
|
+
this.region = region.toUpperCase();
|
|
3971
|
+
if (this.config.blockedRegions.length > 0 && this.config.blockedRegions.includes(this.region)) {
|
|
3972
|
+
this.flags.regionBlocked = true;
|
|
3973
|
+
this.logger.warn({
|
|
3974
|
+
event: "compliance:region_blocked",
|
|
3975
|
+
region: this.region,
|
|
3976
|
+
blockedRegions: this.config.blockedRegions
|
|
3977
|
+
});
|
|
3978
|
+
}
|
|
3979
|
+
}
|
|
3980
|
+
async beforeExecute(toolName, args) {
|
|
3981
|
+
if (!this.config.enabled) return;
|
|
3982
|
+
if (!FINANCIAL_TOOLS.has(toolName)) return;
|
|
3983
|
+
const now = Date.now();
|
|
3984
|
+
this.tradeTimestamps.push(now);
|
|
3985
|
+
const oneMinAgo = now - 6e4;
|
|
3986
|
+
this.tradeTimestamps = this.tradeTimestamps.filter((t) => t > oneMinAgo);
|
|
3987
|
+
const amount = this.parseAmount(args);
|
|
3988
|
+
if (amount > 0) {
|
|
3989
|
+
this.sessionTcVolume += amount;
|
|
3990
|
+
}
|
|
3991
|
+
if (this.tradeTimestamps.length > this.config.velocityTradesPerMin) {
|
|
3992
|
+
this.flags.velocityWarning = true;
|
|
3993
|
+
this.logger.warn({
|
|
3994
|
+
event: "compliance:velocity_warning",
|
|
3995
|
+
tradesInLastMinute: this.tradeTimestamps.length,
|
|
3996
|
+
threshold: this.config.velocityTradesPerMin,
|
|
3997
|
+
tool: toolName
|
|
3998
|
+
});
|
|
3999
|
+
}
|
|
4000
|
+
if (this.sessionTcVolume > this.config.velocityTcPerHour) {
|
|
4001
|
+
this.flags.velocityWarning = true;
|
|
4002
|
+
this.logger.warn({
|
|
4003
|
+
event: "compliance:volume_warning",
|
|
4004
|
+
sessionVolume: this.sessionTcVolume,
|
|
4005
|
+
threshold: this.config.velocityTcPerHour,
|
|
4006
|
+
tool: toolName
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
if (amount > 1e4) {
|
|
4010
|
+
this.flags.largeTransaction = true;
|
|
4011
|
+
this.logger.warn({
|
|
4012
|
+
event: "compliance:large_transaction",
|
|
4013
|
+
amount,
|
|
4014
|
+
tool: toolName
|
|
4015
|
+
});
|
|
4016
|
+
}
|
|
4017
|
+
if (this.flags.regionBlocked) {
|
|
4018
|
+
this.logger.warn({
|
|
4019
|
+
event: "compliance:region_blocked_trade_attempt",
|
|
4020
|
+
region: this.region,
|
|
4021
|
+
tool: toolName
|
|
4022
|
+
});
|
|
4023
|
+
}
|
|
4024
|
+
this.logger.info({
|
|
4025
|
+
event: "compliance:financial_tool",
|
|
4026
|
+
tool: toolName,
|
|
4027
|
+
amount: amount > 0 ? amount : void 0,
|
|
4028
|
+
sessionVolume: this.sessionTcVolume,
|
|
4029
|
+
tradesInLastMinute: this.tradeTimestamps.length,
|
|
4030
|
+
region: this.region,
|
|
4031
|
+
regionBlocked: this.flags.regionBlocked
|
|
4032
|
+
});
|
|
4033
|
+
}
|
|
4034
|
+
async afterExecute(_toolName, _args, _result, _error) {
|
|
4035
|
+
}
|
|
4036
|
+
getStatus() {
|
|
4037
|
+
const now = Date.now();
|
|
4038
|
+
const oneMinAgo = now - 6e4;
|
|
4039
|
+
const recentTrades = this.tradeTimestamps.filter((t) => t > oneMinAgo);
|
|
4040
|
+
return {
|
|
4041
|
+
enabled: this.config.enabled,
|
|
4042
|
+
flags: { ...this.flags },
|
|
4043
|
+
velocity: {
|
|
4044
|
+
tradesLastMinute: recentTrades.length,
|
|
4045
|
+
sessionVolume: this.sessionTcVolume
|
|
4046
|
+
},
|
|
4047
|
+
region: this.region,
|
|
4048
|
+
blockedRegions: this.config.blockedRegions
|
|
4049
|
+
};
|
|
4050
|
+
}
|
|
4051
|
+
parseAmount(args) {
|
|
4052
|
+
if (typeof args !== "object" || args === null) return 0;
|
|
4053
|
+
const a = args;
|
|
4054
|
+
if (typeof a.quantity === "number" && typeof a.price === "number") {
|
|
4055
|
+
return a.quantity * a.price;
|
|
4056
|
+
}
|
|
4057
|
+
if (typeof a.quantity === "number") return a.quantity;
|
|
4058
|
+
if (typeof a.amount === "number") return a.amount;
|
|
4059
|
+
if (typeof a.stake === "number") return a.stake;
|
|
4060
|
+
if (typeof a.initialStake === "number") return a.initialStake;
|
|
4061
|
+
return 0;
|
|
4062
|
+
}
|
|
4063
|
+
};
|
|
4064
|
+
|
|
2360
4065
|
// src/audit.ts
|
|
2361
4066
|
var AUDITED_TOOLS = /* @__PURE__ */ new Set([
|
|
2362
4067
|
"place_order",
|
|
@@ -2858,7 +4563,7 @@ var MetricsCollector = class {
|
|
|
2858
4563
|
function createToromarketClient(options) {
|
|
2859
4564
|
return new import_sdk9.ToromarketClient({
|
|
2860
4565
|
baseUrl: options.baseUrl,
|
|
2861
|
-
clientId: "mcp-server/0.
|
|
4566
|
+
clientId: "mcp-server/0.2.0",
|
|
2862
4567
|
...options.token ? { token: options.token } : {},
|
|
2863
4568
|
...options.apiKey ? { apiKey: options.apiKey } : {},
|
|
2864
4569
|
...options.agentSecret ? { agentSecret: options.agentSecret } : {}
|
|
@@ -2866,10 +4571,10 @@ function createToromarketClient(options) {
|
|
|
2866
4571
|
}
|
|
2867
4572
|
function createToromarketServer(client, baseUrl2, logger, middlewares = [], executeOptions, metrics, toolProfile2, compactDescriptions2) {
|
|
2868
4573
|
const server = new import_server.Server(
|
|
2869
|
-
{ name: "toromarket", version: "0.
|
|
4574
|
+
{ name: "toromarket", version: "0.2.0" },
|
|
2870
4575
|
{ capabilities: { tools: {}, resources: {}, prompts: {}, logging: {} } }
|
|
2871
4576
|
);
|
|
2872
|
-
const allTools = [...PHASE1_TOOLS, ...PHASE2_TOOLS, ...PHASE3_TOOLS, ...FUND_TRADING_TOOLS, ...EXTRA_TOOLS, ...BILLING_TOOLS, ...CONTEXT_TOOLS, ...TRACE_TOOLS, ...IDENTITY_TOOLS];
|
|
4577
|
+
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];
|
|
2873
4578
|
const profileToolSet = toolProfile2 ? getProfileToolSet(toolProfile2) : null;
|
|
2874
4579
|
const profileTools = profileToolSet ? allTools.filter((t) => profileToolSet.has(t.name)) : allTools;
|
|
2875
4580
|
const finalTools = compactDescriptions2 ? profileTools.map((t) => {
|
|
@@ -2994,10 +4699,19 @@ function createServerFactory(options) {
|
|
|
2994
4699
|
const metrics = new MetricsCollector(logger);
|
|
2995
4700
|
const rateLimiter = new RateLimiter();
|
|
2996
4701
|
const traceCollector = new TraceCollector(client, logger, `session-${Date.now()}`);
|
|
4702
|
+
const complianceEnabled = !!process.env.TOROMARKET_COMPLIANCE_MODE;
|
|
4703
|
+
const blockedRegions = (process.env.TOROMARKET_BLOCKED_REGIONS ?? "").split(",").map((r) => r.trim().toUpperCase()).filter(Boolean);
|
|
4704
|
+
const velocityTradesPerMin = Number(process.env.TOROMARKET_VELOCITY_TRADES_PER_MIN) || 30;
|
|
4705
|
+
const velocityTcPerHour = Number(process.env.TOROMARKET_VELOCITY_TC_PER_HOUR) || 5e4;
|
|
4706
|
+
const complianceGate = new ComplianceGate(
|
|
4707
|
+
{ enabled: complianceEnabled, blockedRegions, velocityTradesPerMin, velocityTcPerHour },
|
|
4708
|
+
logger
|
|
4709
|
+
);
|
|
2997
4710
|
const middlewares = [
|
|
2998
4711
|
new RegistrationThrottle(),
|
|
2999
4712
|
rateLimiter,
|
|
3000
4713
|
new SpoofingDetector(),
|
|
4714
|
+
complianceGate,
|
|
3001
4715
|
new SpendingGuardrails(options.maxSessionLoss),
|
|
3002
4716
|
new ErrorBudget(),
|
|
3003
4717
|
new AuditLogger(logger),
|
|
@@ -3008,7 +4722,7 @@ function createServerFactory(options) {
|
|
|
3008
4722
|
let currentTrustTier = null;
|
|
3009
4723
|
const executeOptions = {
|
|
3010
4724
|
traceCollector,
|
|
3011
|
-
|
|
4725
|
+
complianceGate,
|
|
3012
4726
|
onTrustTier: (trustTier) => {
|
|
3013
4727
|
currentTrustTier = trustTier;
|
|
3014
4728
|
logger.info({ event: "trust_tier_applied", trustTier });
|
|
@@ -3049,7 +4763,8 @@ function createServerFactory(options) {
|
|
|
3049
4763
|
notificationService.stop();
|
|
3050
4764
|
notificationService = null;
|
|
3051
4765
|
}
|
|
3052
|
-
}
|
|
4766
|
+
},
|
|
4767
|
+
setRegion: (region) => complianceGate.setRegion(region)
|
|
3053
4768
|
};
|
|
3054
4769
|
};
|
|
3055
4770
|
return { logger, createMcpServer };
|
|
@@ -3136,6 +4851,10 @@ async function startHttpTransport(options) {
|
|
|
3136
4851
|
entry = { transport: transport2, server: createdServer, lastActivity: Date.now() };
|
|
3137
4852
|
sessions.set(newSessionId, entry);
|
|
3138
4853
|
logger.info({ event: "session_created", sessionId: newSessionId });
|
|
4854
|
+
const region = req.headers["cf-ipcountry"] ?? req.headers["x-vercel-ip-country"] ?? req.headers["x-country-code"];
|
|
4855
|
+
if (region && createdServer.setRegion) {
|
|
4856
|
+
createdServer.setRegion(region);
|
|
4857
|
+
}
|
|
3139
4858
|
transport2.onclose = () => {
|
|
3140
4859
|
createdServer.cleanup();
|
|
3141
4860
|
sessions.delete(newSessionId);
|
|
@@ -3239,7 +4958,6 @@ var pollIntervalStr = readEnv("TOROMARKET_POLL_INTERVAL");
|
|
|
3239
4958
|
var pollIntervalMs = pollIntervalStr ? Number(pollIntervalStr) : void 0;
|
|
3240
4959
|
var toolProfile = readEnv("TOROMARKET_TOOL_PROFILE") ?? "full";
|
|
3241
4960
|
var compactDescriptions = readEnv("TOROMARKET_TOOL_DESCRIPTIONS") === "compact";
|
|
3242
|
-
var operatorId = readEnv("TOROMARKET_OPERATOR_ID");
|
|
3243
4961
|
if (!isValidProfile(toolProfile)) {
|
|
3244
4962
|
process.stderr.write(`Invalid TOROMARKET_TOOL_PROFILE: "${toolProfile}". Valid: trader, social, fund_manager, full
|
|
3245
4963
|
`);
|
|
@@ -3254,8 +4972,7 @@ var serverOptions = {
|
|
|
3254
4972
|
...apiKey ? { apiKey } : {},
|
|
3255
4973
|
...agentSecret ? { agentSecret } : {},
|
|
3256
4974
|
...maxSessionLoss ? { maxSessionLoss } : {},
|
|
3257
|
-
...pollIntervalMs !== void 0 ? { pollIntervalMs } : {}
|
|
3258
|
-
...operatorId ? { operatorId } : {}
|
|
4975
|
+
...pollIntervalMs !== void 0 ? { pollIntervalMs } : {}
|
|
3259
4976
|
};
|
|
3260
4977
|
async function main() {
|
|
3261
4978
|
if (transport === "http") {
|