@finchagentic/mcp 4.6.2 → 4.6.3

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.
Files changed (59) hide show
  1. package/README.md +39 -74
  2. package/dist/_http-cache.js +96 -0
  3. package/dist/_text-search.js +39 -0
  4. package/dist/agent-loop.js +301 -0
  5. package/dist/annotations.js +122 -0
  6. package/dist/cli.js +1391 -0
  7. package/dist/clink-input.js +15 -0
  8. package/dist/config.js +132 -0
  9. package/dist/convex.js +175 -0
  10. package/dist/dex-pair.js +54 -0
  11. package/dist/enrichment-router.js +315 -0
  12. package/dist/index.js +258 -0
  13. package/dist/llm.js +298 -0
  14. package/dist/local-memory-file.js +150 -0
  15. package/dist/local-memory.js +135 -0
  16. package/dist/local-vault.js +456 -0
  17. package/dist/output-schemas.js +605 -0
  18. package/dist/project.js +36 -0
  19. package/dist/prompts.js +111 -0
  20. package/dist/public-url.js +107 -0
  21. package/dist/resources.js +111 -0
  22. package/dist/server.js +322 -0
  23. package/dist/signal-gate.js +57 -0
  24. package/dist/token-decimals.js +26 -0
  25. package/dist/token-gate.js +88 -0
  26. package/dist/tool-filter.js +53 -0
  27. package/dist/tools/_solidity-scan.js +313 -0
  28. package/dist/tools/agents.js +441 -0
  29. package/dist/tools/automation.js +354 -0
  30. package/dist/tools/base-mcp.js +466 -0
  31. package/dist/tools/base.js +283 -0
  32. package/dist/tools/chronicle.js +268 -0
  33. package/dist/tools/coder.js +94 -0
  34. package/dist/tools/deep-research.js +1421 -0
  35. package/dist/tools/defi.js +292 -0
  36. package/dist/tools/equity.js +372 -0
  37. package/dist/tools/events.js +182 -0
  38. package/dist/tools/github.js +564 -0
  39. package/dist/tools/insider.js +264 -0
  40. package/dist/tools/insight.js +630 -0
  41. package/dist/tools/market.js +555 -0
  42. package/dist/tools/memory.js +1059 -0
  43. package/dist/tools/miroshark.js +350 -0
  44. package/dist/tools/monitor.js +319 -0
  45. package/dist/tools/os.js +236 -0
  46. package/dist/tools/packets.js +296 -0
  47. package/dist/tools/research-chain.js +226 -0
  48. package/dist/tools/research-compare.js +280 -0
  49. package/dist/tools/research.js +188 -0
  50. package/dist/tools/rh-bridge.js +148 -0
  51. package/dist/tools/rh-mcp.js +1448 -0
  52. package/dist/tools/rh-orders.js +556 -0
  53. package/dist/tools/scanner.js +564 -0
  54. package/dist/tools/stake.js +369 -0
  55. package/dist/tools/vault.js +1020 -0
  56. package/dist/tools/wallet.js +200 -0
  57. package/dist/types.js +2 -0
  58. package/dist/wallet.js +372 -0
  59. package/package.json +4 -7
@@ -0,0 +1,605 @@
1
+ "use strict";
2
+ // Central registry of MCP tool `outputSchema` declarations (spec 2025-06-18).
3
+ //
4
+ // A tool that declares an outputSchema SHOULD also return `structuredContent`
5
+ // conforming to it (its handler does; the human-readable `content` text stays
6
+ // for backward compatibility). Keeping every schema in one file - rather than
7
+ // inline on each tool definition across ~25 modules - makes the machine-readable
8
+ // surface reviewable in one place, mirrors how annotations.ts centralises
9
+ // behavioural hints, and lets a new tool opt in by adding one entry here plus a
10
+ // structuredContent return in its handler (no tool-definition edit needed).
11
+ //
12
+ // Attached to the listed tools by withAnnotations() (annotations.ts) at
13
+ // tools/list time. Only tools whose handler genuinely emits matching
14
+ // structuredContent belong here.
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.OUTPUT_SCHEMAS = void 0;
17
+ const number_null = { type: ["number", "null"] };
18
+ const string_null = { type: ["string", "null"] };
19
+ exports.OUTPUT_SCHEMAS = {
20
+ // ── market ────────────────────────────────────────────────────────────────
21
+ get_token_data: {
22
+ type: "object",
23
+ properties: {
24
+ symbol: string_null,
25
+ name: string_null,
26
+ priceUsd: number_null,
27
+ change24hPct: number_null,
28
+ marketCapUsd: number_null,
29
+ marketCapRank: number_null,
30
+ volume24hUsd: number_null,
31
+ high24hUsd: number_null,
32
+ low24hUsd: number_null,
33
+ athUsd: number_null,
34
+ athChangePct: number_null,
35
+ source: { type: "string" },
36
+ },
37
+ required: ["symbol", "name", "source"],
38
+ },
39
+ get_base_token_data: {
40
+ type: "object",
41
+ properties: {
42
+ address: { type: "string" },
43
+ symbol: string_null,
44
+ name: string_null,
45
+ priceUsd: number_null,
46
+ change1hPct: number_null,
47
+ change6hPct: number_null,
48
+ change24hPct: number_null,
49
+ volume24hUsd: number_null,
50
+ liquidityUsd: number_null,
51
+ marketCapUsd: number_null,
52
+ fdvUsd: number_null,
53
+ pairAgeDays: number_null,
54
+ listedOnCoingecko: { type: "boolean" },
55
+ coingeckoId: string_null,
56
+ source: { type: "string" },
57
+ },
58
+ required: ["address", "source", "listedOnCoingecko"],
59
+ },
60
+ compare_tokens: {
61
+ type: "object",
62
+ properties: {
63
+ count: { type: "number" },
64
+ unknown: { type: "array", items: { type: "string" } },
65
+ tokens: {
66
+ type: "array",
67
+ items: {
68
+ type: "object",
69
+ properties: {
70
+ symbol: string_null,
71
+ name: string_null,
72
+ priceUsd: number_null,
73
+ change24hPct: number_null,
74
+ change7dPct: number_null,
75
+ marketCapUsd: number_null,
76
+ marketCapRank: number_null,
77
+ volume24hUsd: number_null,
78
+ athChangePct: number_null,
79
+ },
80
+ },
81
+ },
82
+ },
83
+ required: ["count", "tokens"],
84
+ },
85
+ // ── scanner ───────────────────────────────────────────────────────────────
86
+ score_token: {
87
+ type: "object",
88
+ properties: {
89
+ address: { type: "string" },
90
+ symbol: { type: "string" },
91
+ priceUsd: { type: "number" },
92
+ liquidityUsd: { type: "number" },
93
+ score: { type: "number", description: "0–100 dip-reversal score" },
94
+ pattern: { type: ["string", "null"], description: "DEEP-REVERSAL | REVERSAL | DIP-BUY | SHALLOW-DIP, or null when gates failed" },
95
+ passed: { type: "boolean", description: "false when hard gates failed" },
96
+ gateFailures: { type: "array", items: { type: "string" } },
97
+ breakdown: { type: "object", additionalProperties: true },
98
+ },
99
+ required: ["address", "symbol", "score", "passed"],
100
+ },
101
+ check_token: {
102
+ type: "object",
103
+ properties: {
104
+ address: { type: "string" },
105
+ verdict: { type: "string", enum: ["DANGER", "CAUTION", "SAFE"] },
106
+ rugScore: { type: "number", description: "0–100, higher = riskier" },
107
+ isHoneypot: { type: "boolean" },
108
+ isMintable: { type: "boolean" },
109
+ isFreezeAuth: { type: "boolean" },
110
+ isOpenSource: { type: "boolean" },
111
+ lpLockedPct: { type: "number" },
112
+ buyTax: { type: "number" },
113
+ sellTax: { type: "number" },
114
+ holderCount: number_null,
115
+ },
116
+ required: ["address", "verdict", "rugScore"],
117
+ },
118
+ // ── wallet ────────────────────────────────────────────────────────────────
119
+ get_wallet_balance: {
120
+ type: "object",
121
+ properties: {
122
+ address: { type: "string" },
123
+ chain: { type: "string" },
124
+ ethBalance: { type: "number" },
125
+ usdcBalance: { type: "number" },
126
+ ethPriceUsd: number_null,
127
+ ethValueUsd: number_null,
128
+ },
129
+ required: ["address", "chain", "ethBalance", "usdcBalance"],
130
+ },
131
+ // ── Robinhood Chain ─────────────────────────────────────────────────────────
132
+ rh_safety_check: {
133
+ type: "object",
134
+ properties: {
135
+ address: { type: "string" },
136
+ symbol: string_null,
137
+ name: string_null,
138
+ riskScore: { type: "number", description: "0–100, higher = riskier" },
139
+ tier: { type: "string", enum: ["DANGER", "CAUTION", "SOME RISK", "LOOKS OK"] },
140
+ verified: { type: ["boolean", "null"] },
141
+ contractName: string_null,
142
+ reputation: string_null,
143
+ holdersCount: number_null,
144
+ creator: string_null,
145
+ launchpad: { type: ["object", "null"], additionalProperties: true },
146
+ flags: { type: "array", items: { type: "string" } },
147
+ },
148
+ required: ["address", "riskScore", "tier", "flags"],
149
+ },
150
+ rh_analyze: {
151
+ type: "object",
152
+ properties: {
153
+ address: { type: "string" },
154
+ symbol: string_null,
155
+ name: string_null,
156
+ priceUsd: number_null,
157
+ change1hPct: number_null,
158
+ change24hPct: number_null,
159
+ liquidityUsd: number_null,
160
+ volume24hUsd: number_null,
161
+ fdvUsd: number_null,
162
+ marketCapUsd: number_null,
163
+ buys24h: number_null,
164
+ sells24h: number_null,
165
+ pairAgeDays: number_null,
166
+ riskScore: { type: "number", description: "0–100, higher = riskier" },
167
+ tier: { type: "string", enum: ["EXTREME", "HIGH", "MEDIUM", "LOWER"] },
168
+ flags: { type: "array", items: { type: "string" } },
169
+ },
170
+ required: ["address", "riskScore", "tier", "flags"],
171
+ },
172
+ rh_mcp_list_stocks: {
173
+ type: "object",
174
+ properties: {
175
+ count: { type: "number" },
176
+ stocks: {
177
+ type: "array",
178
+ items: {
179
+ type: "object",
180
+ properties: {
181
+ symbol: { type: "string" },
182
+ name: { type: "string" },
183
+ address: { type: "string" },
184
+ },
185
+ required: ["symbol", "name", "address"],
186
+ },
187
+ },
188
+ },
189
+ required: ["count", "stocks"],
190
+ },
191
+ // ── Base ────────────────────────────────────────────────────────────────────
192
+ base_mcp_resolve: {
193
+ type: "object",
194
+ properties: {
195
+ input: { type: "string" },
196
+ address: string_null,
197
+ name: string_null,
198
+ resolved: { type: "boolean" },
199
+ },
200
+ required: ["input", "resolved"],
201
+ },
202
+ // ── SEC equities ────────────────────────────────────────────────────────────
203
+ stock_fundamentals: {
204
+ type: "object",
205
+ properties: {
206
+ ticker: { type: "string" },
207
+ companyName: string_null,
208
+ cik: string_null,
209
+ quote: {
210
+ type: ["object", "null"],
211
+ additionalProperties: true,
212
+ description: "{ price, currency, prevClose, prevDate } - null when a live quote wasn't available",
213
+ },
214
+ quarterly: {
215
+ type: "object",
216
+ additionalProperties: { type: "array", items: { type: "object", additionalProperties: true } },
217
+ description: "Per-concept arrays of { end, val, form, fy, fp } facts, most recent last",
218
+ },
219
+ annual: {
220
+ type: "object",
221
+ additionalProperties: { type: "array", items: { type: "object", additionalProperties: true } },
222
+ description: "Per-concept arrays of { end, val, form, fy, fp } facts, most recent last",
223
+ },
224
+ },
225
+ required: ["ticker", "quarterly", "annual"],
226
+ },
227
+ stock_events: {
228
+ type: "object",
229
+ properties: {
230
+ ticker: { type: "string" },
231
+ companyName: string_null,
232
+ signalOnly: { type: "boolean" },
233
+ count: { type: "number" },
234
+ events: {
235
+ type: "array",
236
+ items: {
237
+ type: "object",
238
+ properties: {
239
+ filingDate: { type: "string" },
240
+ reportDate: string_null,
241
+ codes: { type: "array", items: { type: "string" } },
242
+ hasSignal: { type: "boolean" },
243
+ url: { type: "string" },
244
+ },
245
+ required: ["filingDate", "codes", "hasSignal", "url"],
246
+ },
247
+ },
248
+ },
249
+ required: ["ticker", "count", "events"],
250
+ },
251
+ stock_insider: {
252
+ type: "object",
253
+ properties: {
254
+ ticker: { type: "string" },
255
+ companyName: string_null,
256
+ filingsParsed: { type: "number" },
257
+ skippedOtherIssuer: { type: "number" },
258
+ buys: { type: "object", additionalProperties: true, description: "{ count, shares, valueUsd } of open-market discretionary buys" },
259
+ sells: { type: "object", additionalProperties: true, description: "{ count, shares, valueUsd } of open-market discretionary sells" },
260
+ netBuyValueUsd: { type: "number", description: "buys value − sells value (discretionary only)" },
261
+ automaticCount: { type: "number", description: "non-discretionary txns (grants, RSU tax, option exercises)" },
262
+ transactions: {
263
+ type: "array",
264
+ description: "Up to 12 most-recent discretionary transactions",
265
+ items: { type: "object", additionalProperties: true },
266
+ },
267
+ },
268
+ required: ["ticker", "buys", "sells", "transactions"],
269
+ },
270
+ // ── GitHub ──────────────────────────────────────────────────────────────────
271
+ github_list_repos: {
272
+ type: "object",
273
+ properties: {
274
+ username: string_null,
275
+ count: { type: "number" },
276
+ repos: { type: "array", items: { type: "object", additionalProperties: true } },
277
+ },
278
+ required: ["count", "repos"],
279
+ },
280
+ github_list_prs: {
281
+ type: "object",
282
+ properties: {
283
+ owner: { type: "string" },
284
+ repo: { type: "string" },
285
+ state: { type: "string" },
286
+ count: { type: "number" },
287
+ prs: { type: "array", items: { type: "object", additionalProperties: true } },
288
+ },
289
+ required: ["owner", "repo", "count", "prs"],
290
+ },
291
+ github_get_pr: {
292
+ type: "object",
293
+ properties: {
294
+ number: { type: "number" },
295
+ title: { type: "string" },
296
+ state: { type: "string" },
297
+ draft: { type: "boolean" },
298
+ author: string_null,
299
+ head: string_null,
300
+ base: string_null,
301
+ additions: { type: "number" },
302
+ deletions: { type: "number" },
303
+ changedFiles: { type: "number" },
304
+ url: { type: "string" },
305
+ files: { type: "array", items: { type: "object", additionalProperties: true } },
306
+ reviewCount: { type: "number" },
307
+ commentCount: { type: "number" },
308
+ },
309
+ required: ["number", "title", "state", "files"],
310
+ },
311
+ github_list_issues: {
312
+ type: "object",
313
+ properties: {
314
+ owner: { type: "string" },
315
+ repo: { type: "string" },
316
+ state: { type: "string" },
317
+ count: { type: "number" },
318
+ issues: { type: "array", items: { type: "object", additionalProperties: true } },
319
+ },
320
+ required: ["owner", "repo", "count", "issues"],
321
+ },
322
+ github_get_issue: {
323
+ type: "object",
324
+ properties: {
325
+ number: { type: "number" },
326
+ title: { type: "string" },
327
+ state: { type: "string" },
328
+ author: string_null,
329
+ labels: { type: "array", items: { type: "string" } },
330
+ assignees: { type: "array", items: { type: "string" } },
331
+ commentCount: { type: "number" },
332
+ url: { type: "string" },
333
+ createdAt: string_null,
334
+ },
335
+ required: ["number", "title", "state"],
336
+ },
337
+ github_get_file: {
338
+ type: "object",
339
+ properties: {
340
+ owner: { type: "string" },
341
+ repo: { type: "string" },
342
+ path: { type: "string" },
343
+ ref: string_null,
344
+ isFile: { type: "boolean" },
345
+ sizeBytes: number_null,
346
+ sha: string_null,
347
+ url: string_null,
348
+ language: { type: "string" },
349
+ truncated: { type: "boolean" },
350
+ content: { type: "string" },
351
+ },
352
+ required: ["owner", "repo", "path", "isFile"],
353
+ },
354
+ github_get_commits: {
355
+ type: "object",
356
+ properties: {
357
+ owner: { type: "string" },
358
+ repo: { type: "string" },
359
+ branch: string_null,
360
+ path: string_null,
361
+ count: { type: "number" },
362
+ commits: { type: "array", items: { type: "object", additionalProperties: true } },
363
+ },
364
+ required: ["owner", "repo", "count", "commits"],
365
+ },
366
+ github_search_code: {
367
+ type: "object",
368
+ properties: {
369
+ query: { type: "string" },
370
+ totalCount: { type: "number" },
371
+ count: { type: "number" },
372
+ results: { type: "array", items: { type: "object", additionalProperties: true } },
373
+ },
374
+ required: ["query", "count", "results"],
375
+ },
376
+ // ── chronicle ───────────────────────────────────────────────────────────────
377
+ chronicle_list: {
378
+ type: "object",
379
+ properties: {
380
+ type: string_null,
381
+ count: { type: "number" },
382
+ entries: { type: "array", items: { type: "object", additionalProperties: true } },
383
+ },
384
+ required: ["count", "entries"],
385
+ },
386
+ chronicle_search: {
387
+ type: "object",
388
+ properties: {
389
+ query: { type: "string" },
390
+ type: string_null,
391
+ count: { type: "number" },
392
+ entries: { type: "array", items: { type: "object", additionalProperties: true } },
393
+ },
394
+ required: ["query", "count", "entries"],
395
+ },
396
+ chronicle_stats: {
397
+ type: "object",
398
+ properties: {
399
+ days: { type: "number" },
400
+ totalEvents: { type: "number" },
401
+ activeDays: { type: "number" },
402
+ avgPerDay: { type: "number" },
403
+ byType: { type: "array", items: { type: "object", additionalProperties: true } },
404
+ busiestDays: { type: "array", items: { type: "object", additionalProperties: true } },
405
+ },
406
+ required: ["days", "totalEvents", "byType"],
407
+ },
408
+ // ── automation / monitor / packet ───────────────────────────────────────────
409
+ list_automations: {
410
+ type: "object",
411
+ properties: {
412
+ count: { type: "number" },
413
+ automations: { type: "array", items: { type: "object", additionalProperties: true } },
414
+ },
415
+ required: ["count", "automations"],
416
+ },
417
+ get_automation_runs: {
418
+ type: "object",
419
+ properties: {
420
+ automationId: { type: "string" },
421
+ count: { type: "number" },
422
+ runs: { type: "array", items: { type: "object", additionalProperties: true } },
423
+ },
424
+ required: ["automationId", "count", "runs"],
425
+ },
426
+ list_monitors: {
427
+ type: "object",
428
+ properties: {
429
+ count: { type: "number" },
430
+ monitors: { type: "array", items: { type: "object", additionalProperties: true } },
431
+ },
432
+ required: ["count", "monitors"],
433
+ },
434
+ packet_list: {
435
+ type: "object",
436
+ properties: {
437
+ count: { type: "number" },
438
+ packets: { type: "array", items: { type: "object", additionalProperties: true } },
439
+ },
440
+ required: ["count", "packets"],
441
+ },
442
+ // ── vault ───────────────────────────────────────────────────────────────────
443
+ vault_list: {
444
+ type: "object",
445
+ properties: {
446
+ type: string_null,
447
+ count: { type: "number" },
448
+ entries: {
449
+ type: "array",
450
+ items: {
451
+ type: "object",
452
+ properties: {
453
+ key: { type: "string" },
454
+ title: string_null,
455
+ type: string_null,
456
+ version: { type: "number" },
457
+ size: number_null,
458
+ updatedAt: number_null,
459
+ isPinned: { type: "boolean" },
460
+ },
461
+ required: ["key"],
462
+ },
463
+ },
464
+ },
465
+ required: ["count", "entries"],
466
+ },
467
+ vault_search: {
468
+ type: "object",
469
+ properties: {
470
+ query: { type: "string" },
471
+ count: { type: "number" },
472
+ results: {
473
+ type: "array",
474
+ items: {
475
+ type: "object",
476
+ properties: {
477
+ key: { type: "string" },
478
+ title: string_null,
479
+ type: string_null,
480
+ score: number_null,
481
+ preview: string_null,
482
+ },
483
+ required: ["key"],
484
+ },
485
+ },
486
+ },
487
+ required: ["query", "count", "results"],
488
+ },
489
+ // ── memory ──────────────────────────────────────────────────────────────────
490
+ memory_search: {
491
+ type: "object",
492
+ properties: {
493
+ query: { type: "string" },
494
+ count: { type: "number" },
495
+ memories: { type: "array", items: { type: "object", additionalProperties: true } },
496
+ },
497
+ required: ["query", "count", "memories"],
498
+ },
499
+ memory_context: {
500
+ type: "object",
501
+ properties: {
502
+ topic: { type: "string" },
503
+ count: { type: "number" },
504
+ memories: { type: "array", items: { type: "object", additionalProperties: true } },
505
+ },
506
+ required: ["topic", "count", "memories"],
507
+ },
508
+ memory_profile: {
509
+ type: "object",
510
+ properties: {
511
+ space: string_null,
512
+ total: { type: "number" },
513
+ status: { type: "string" },
514
+ },
515
+ required: ["total", "status"],
516
+ },
517
+ memory_list: {
518
+ type: "object",
519
+ properties: {
520
+ tag: string_null,
521
+ count: { type: "number" },
522
+ memories: { type: "array", items: { type: "object", additionalProperties: true } },
523
+ },
524
+ required: ["count", "memories"],
525
+ },
526
+ // ── agents ──────────────────────────────────────────────────────────────────
527
+ agent_ledger: {
528
+ type: "object",
529
+ properties: {
530
+ name: { type: "string" },
531
+ count: { type: "number" },
532
+ versions: { type: "array", items: { type: "object", additionalProperties: true } },
533
+ },
534
+ required: ["name", "count", "versions"],
535
+ },
536
+ // ── scanner / orders / wallet ────────────────────────────────────────────────
537
+ scan_market: {
538
+ type: "object",
539
+ properties: {
540
+ mode: { type: "string", enum: ["dips", "momentum"] },
541
+ scanned: { type: "number" },
542
+ count: { type: "number" },
543
+ results: { type: "array", items: { type: "object", additionalProperties: true } },
544
+ },
545
+ required: ["mode", "scanned", "count", "results"],
546
+ },
547
+ rh_orders_list: {
548
+ type: "object",
549
+ properties: {
550
+ count: { type: "number" },
551
+ orders: { type: "array", items: { type: "object", additionalProperties: true } },
552
+ },
553
+ required: ["count", "orders"],
554
+ },
555
+ get_wallet_address: {
556
+ type: "object",
557
+ properties: {
558
+ address: { type: "string" },
559
+ chain: { type: "string" },
560
+ chainId: { type: "number" },
561
+ },
562
+ required: ["address", "chain", "chainId"],
563
+ },
564
+ // ── market overview / history / defi yields ─────────────────────────────────
565
+ market_overview: {
566
+ type: "object",
567
+ properties: {
568
+ fearGreedValue: number_null,
569
+ fearGreedClass: string_null,
570
+ totalMarketCapUsd: number_null,
571
+ marketCap24hChangePct: number_null,
572
+ btcDominancePct: number_null,
573
+ ethDominancePct: number_null,
574
+ defiTvlUsd: number_null,
575
+ activeCoins: number_null,
576
+ trending: { type: "array", items: { type: "object", additionalProperties: true } },
577
+ },
578
+ required: ["trending"],
579
+ },
580
+ token_history: {
581
+ type: "object",
582
+ properties: {
583
+ symbol: { type: "string" },
584
+ days: { type: "number" },
585
+ currentPriceUsd: number_null,
586
+ openPrice: { type: "number" },
587
+ closePrice: { type: "number" },
588
+ periodChangePct: number_null,
589
+ periodHighUsd: { type: "number" },
590
+ periodLowUsd: { type: "number" },
591
+ candles: { type: "array", items: { type: "object", additionalProperties: true } },
592
+ },
593
+ required: ["symbol", "days", "candles"],
594
+ },
595
+ get_defi_yields: {
596
+ type: "object",
597
+ properties: {
598
+ token: string_null,
599
+ minApy: { type: "number" },
600
+ count: { type: "number" },
601
+ pools: { type: "array", items: { type: "object", additionalProperties: true } },
602
+ },
603
+ required: ["count", "pools"],
604
+ },
605
+ };
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isLocalVaultActive = isLocalVaultActive;
4
+ exports.resolveProjectId = resolveProjectId;
5
+ const convex_js_1 = require("./convex.js");
6
+ const local_vault_js_1 = require("./local-vault.js");
7
+ // MCP has no persistent "active project" UI state the way the webapp Sidebar
8
+ // switcher does - a caller (vault_save, agent_spawn) names the project it
9
+ // wants by string on each call instead. Resolution + auto-create both happen
10
+ // server-side (POST /projects/resolve, see convex/http.ts +
11
+ // convex/projects.ts's resolveOrCreateProjectForUser) so the match/dedup
12
+ // logic exists in exactly one place, shared with the webapp's own project
13
+ // picker.
14
+ //
15
+ // Local-vault mode (vaultBackend: "local") has no project concept at all -
16
+ // it's a flat, unauthenticated file store on the user's own machine with no
17
+ // server to resolve a name against. Callers should check
18
+ // isLocalVaultActive() first and skip resolution entirely rather than call
19
+ // this and get a confusing network-style failure.
20
+ function isLocalVaultActive() {
21
+ return !!(0, local_vault_js_1.getLocalVaultConfig)();
22
+ }
23
+ async function resolveProjectId(name) {
24
+ const trimmed = name.trim();
25
+ if (!trimmed)
26
+ return null;
27
+ try {
28
+ return await (0, convex_js_1.callConvex)("/projects/resolve", "POST", { name: trimmed }, "vault_save");
29
+ }
30
+ catch {
31
+ // Resolution is best-effort - a save should never fail just because the
32
+ // project lookup did. Falls back to unassigned, same as the webapp's
33
+ // agent_spawn membership check when a stale/bad id doesn't match.
34
+ return null;
35
+ }
36
+ }