@arcadia-finance/mcp-server 0.5.2 → 0.6.0

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 (53) hide show
  1. package/README.md +47 -42
  2. package/dist/clients/api.js +52 -5
  3. package/dist/clients/chain.js +1 -1
  4. package/dist/config/addresses.js +16 -3
  5. package/dist/index.js +36 -134
  6. package/dist/prompts/workflows.js +54 -18
  7. package/dist/resources/guides.js +1 -1
  8. package/dist/tools/aero.js +157 -0
  9. package/dist/tools/dev/send.js +4 -4
  10. package/dist/tools/index.js +6 -0
  11. package/dist/tools/output-schemas.js +103 -29
  12. package/dist/tools/read/account.js +13 -13
  13. package/dist/tools/read/aero-upgrade.js +53 -0
  14. package/dist/tools/read/asset-managers.js +9 -9
  15. package/dist/tools/read/assets.js +7 -7
  16. package/dist/tools/read/guides.js +4 -4
  17. package/dist/tools/read/points.js +4 -4
  18. package/dist/tools/read/pools.js +8 -8
  19. package/dist/tools/read/strategy.js +12 -12
  20. package/dist/tools/read/wallet.js +15 -15
  21. package/dist/tools/write/account/add-liquidity.js +9 -9
  22. package/dist/tools/write/account/aero-upgrade.js +124 -0
  23. package/dist/tools/write/account/borrow.js +5 -5
  24. package/dist/tools/write/account/close.js +8 -8
  25. package/dist/tools/write/account/create.js +3 -3
  26. package/dist/tools/write/account/deleverage.js +4 -4
  27. package/dist/tools/write/account/deposit.js +4 -4
  28. package/dist/tools/write/account/format-response.js +1 -1
  29. package/dist/tools/write/account/remove-liquidity.js +6 -6
  30. package/dist/tools/write/account/repay.js +4 -4
  31. package/dist/tools/write/account/stake.js +5 -5
  32. package/dist/tools/write/account/swap.js +4 -4
  33. package/dist/tools/write/account/withdraw.js +5 -5
  34. package/dist/tools/write/asset-managers/automations.js +14 -14
  35. package/dist/tools/write/asset-managers/intents.js +10 -7
  36. package/dist/tools/write/pool/deposit.js +5 -5
  37. package/dist/tools/write/pool/redeem.js +4 -4
  38. package/dist/tools/write/wallet/approve.js +4 -4
  39. package/dist/tools/write/wallet/upgrade-velo.js +76 -0
  40. package/dist/utils/analytics.js +68 -0
  41. package/dist/utils/http-config.js +4 -4
  42. package/llms-full.txt +83 -46
  43. package/llms.txt +47 -44
  44. package/package.json +8 -4
  45. package/server.json +4 -4
  46. package/skills/clamm-liquidity/SKILL.md +100 -82
  47. package/skills/clamm-liquidity/automation.md +14 -14
  48. package/skills/clamm-liquidity/selection.md +13 -13
  49. package/skills/clamm-liquidity/strategies.md +135 -53
  50. package/skills/openclaw/SKILL.md +3 -3
  51. package/skills/openclaw/arcadia.sh +24 -45
  52. package/skills/openclaw/contracts.md +11 -10
  53. package/dist/utils/tool-naming.js +0 -91
@@ -0,0 +1,53 @@
1
+ import { z } from "zod";
2
+ import { validateAddress } from "../../utils/validation.js";
3
+ import { aeroErrorResult, validateAeroChain } from "../aero.js";
4
+ import { AeroUpgradeCandidatesOutput } from "../output-schemas.js";
5
+ export function registerAeroUpgradeReadTool(server, api) {
6
+ server.registerTool("read_account_aero_upgrade", {
7
+ annotations: {
8
+ title: "Check Aero Upgrade Candidates",
9
+ readOnlyHint: true,
10
+ destructiveHint: false,
11
+ idempotentHint: true,
12
+ openWorldHint: true,
13
+ },
14
+ description: "Which Arcadia accounts have something to upgrade to Aero (MetadexCL V1): Slipstream V1 to V3 positions (Aerodrome on Base, Velodrome on Optimism, staked or not) and old AERO. Pass wallet_address for every account of a wallet, or account_address for one. " +
15
+ "Per account: status (ready | choices_required | waiting | not_open | nothing_to_upgrade), positions (every Slipstream position on it), movable (ready or needing a pool choice), waiting, blocked, old_aero (raw, 18 decimals). Accounts without a Slipstream position or old AERO are left out, including accounts whose positions already moved but whose automations still run on the old Slipstream managers: when read_asset_manager_current shows Slipstream managers on an account that only holds metadexcl_v1 positions, call write_account_aero_upgrade for it to get managers_to_reconnect. failed_accounts lists the accounts whose check failed, with the error: an empty accounts list means nothing to do only when failed_accounts is empty too. Otherwise tell the user those accounts could not be checked and retry later. opens_at is when the AERO token upgrade opens on Base. " +
16
+ "No calldata, prices or simulation: this is the cheap check. For the plan and the transaction call write_account_aero_upgrade. Chains: Base (8453), Optimism (10); Robinhood (4663) has no Slipstream positions and answers an empty list.",
17
+ inputSchema: z.object({
18
+ wallet_address: z
19
+ .string()
20
+ .optional()
21
+ .describe("Wallet whose accounts to check. Pass this or account_address, not both."),
22
+ account_address: z.string().optional().describe("One Arcadia account to check"),
23
+ chain_id: z
24
+ .number()
25
+ .default(8453)
26
+ .describe("Chain ID: 8453 (Base), 10 (Optimism) or 4663 (Robinhood, nothing to upgrade)"),
27
+ }),
28
+ outputSchema: AeroUpgradeCandidatesOutput,
29
+ }, async ({ wallet_address, account_address, chain_id }) => {
30
+ try {
31
+ if ((wallet_address === undefined) === (account_address === undefined)) {
32
+ throw new Error("Pass exactly one of wallet_address and account_address.");
33
+ }
34
+ const chainId = validateAeroChain(chain_id);
35
+ const result = await api.getAeroUpgradeCandidates({
36
+ chain_id: chainId,
37
+ owner_address: wallet_address === undefined
38
+ ? undefined
39
+ : validateAddress(wallet_address, "wallet_address"),
40
+ account_address: account_address === undefined
41
+ ? undefined
42
+ : validateAddress(account_address, "account_address"),
43
+ });
44
+ return {
45
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
46
+ structuredContent: result,
47
+ };
48
+ }
49
+ catch (err) {
50
+ return aeroErrorResult(err);
51
+ }
52
+ });
53
+ }
@@ -46,9 +46,9 @@ const INTENT_CATALOG = [
46
46
  needs_position_context: true,
47
47
  },
48
48
  ];
49
- const USAGE = "Build an intents array from these kinds and pass it to write.account.automations (full desired state) or write.account.automations_delta (change one automation, leave the rest alone). The backend resolves the asset managers, validates the combination and returns the unsigned transaction.";
49
+ const USAGE = "Build an intents array from these kinds and pass it to write_account_automations (full desired state) or write_account_automations_delta (change one automation, leave the rest alone). The backend resolves the asset managers, validates the combination and returns the unsigned transaction.";
50
50
  export function registerAssetManagerTools(server, api) {
51
- server.registerTool("read.asset_manager.intents", {
51
+ server.registerTool("read_asset_manager_intents", {
52
52
  annotations: {
53
53
  title: "List Available Automations",
54
54
  readOnlyHint: true,
@@ -60,7 +60,7 @@ export function registerAssetManagerTools(server, api) {
60
60
  "Pass account_address to also get per-account availability: which intents can be enabled right now and, for any that cannot, the compatibility rule blocking it. " +
61
61
  "Pass position_id as well to scope availability to one LP position. Without account_address this returns the catalog only.",
62
62
  outputSchema: IntentsListOutput,
63
- inputSchema: {
63
+ inputSchema: z.object({
64
64
  account_address: z
65
65
  .string()
66
66
  .optional()
@@ -74,7 +74,7 @@ export function registerAssetManagerTools(server, api) {
74
74
  .number()
75
75
  .default(8453)
76
76
  .describe("Chain id: 8453 Base, 130 Unichain, 10 Optimism"),
77
- },
77
+ }),
78
78
  }, async (params) => {
79
79
  try {
80
80
  const chainId = validateChainId(params.chain_id);
@@ -107,7 +107,7 @@ export function registerAssetManagerTools(server, api) {
107
107
  automations,
108
108
  ...(availabilityError
109
109
  ? {
110
- availability_error: `Per-account availability could not be read: ${availabilityError}. The catalog below is complete, but no intent is annotated as available or blocked. write.account.automations still validates the combination.`,
110
+ availability_error: `Per-account availability could not be read: ${availabilityError}. The catalog below is complete, but no intent is annotated as available or blocked. write_account_automations still validates the combination.`,
111
111
  }
112
112
  : {}),
113
113
  shared_params: [
@@ -134,7 +134,7 @@ export function registerAssetManagerTools(server, api) {
134
134
  };
135
135
  }
136
136
  });
137
- server.registerTool("read.asset_manager.current", {
137
+ server.registerTool("read_asset_manager_current", {
138
138
  annotations: {
139
139
  title: "Read Current Account Automations",
140
140
  readOnlyHint: true,
@@ -144,16 +144,16 @@ export function registerAssetManagerTools(server, api) {
144
144
  },
145
145
  description: "Read which asset managers are currently enabled on an account, with their decoded on-chain configuration. " +
146
146
  "Returns the active managers (address, protocol, initiator, decoded strategy metadata, slippage and value-loss caps, fee recipient), the intents they map to, and Merkl claim state including whether reward tokens still need registering. " +
147
- "Managers from superseded deployments are listed separately under `deprecated`: pass their addresses to write.account.automations_delta to clear them, or run write.account.automations which disables them as part of the save. " +
147
+ "Managers from superseded deployments are listed separately under `deprecated`: pass their addresses to write_account_automations_delta to clear them, or run write_account_automations which disables them as part of the save. " +
148
148
  "read_ok is false when chain state could not be read, in which case the result is unreliable rather than empty.",
149
149
  outputSchema: AutomationsStateOutput,
150
- inputSchema: {
150
+ inputSchema: z.object({
151
151
  account_address: z.string().describe("Arcadia account address"),
152
152
  chain_id: z
153
153
  .number()
154
154
  .default(8453)
155
155
  .describe("Chain id: 8453 Base, 130 Unichain, 10 Optimism"),
156
- },
156
+ }),
157
157
  }, async (params) => {
158
158
  try {
159
159
  const chainId = validateChainId(params.chain_id);
@@ -3,7 +3,7 @@ import { expectArrayOrWrapped } from "./shapes.js";
3
3
  import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
4
4
  import { AssetListOutput, AssetPricesOutput } from "../output-schemas.js";
5
5
  export function registerAssetTools(server, api) {
6
- server.registerTool("read.asset.list", {
6
+ server.registerTool("read_asset_list", {
7
7
  annotations: {
8
8
  title: "List Supported Assets",
9
9
  readOnlyHint: true,
@@ -11,14 +11,14 @@ export function registerAssetTools(server, api) {
11
11
  idempotentHint: true,
12
12
  openWorldHint: true,
13
13
  },
14
- description: "List supported collateral assets on Arcadia. Returns compact list (address, symbol, decimals, type). Use search to filter by symbol substring. For USD prices, use read.asset.prices.",
15
- inputSchema: {
14
+ description: "List supported collateral assets on Arcadia. Returns compact list (address, symbol, decimals, type). Use search to filter by symbol substring. For USD prices, use read_asset_prices.",
15
+ inputSchema: z.object({
16
16
  search: z
17
17
  .string()
18
18
  .optional()
19
19
  .describe("Filter assets by symbol (case-insensitive substring match)"),
20
20
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
21
- },
21
+ }),
22
22
  outputSchema: AssetListOutput,
23
23
  }, async ({ search, chain_id }) => {
24
24
  try {
@@ -52,7 +52,7 @@ export function registerAssetTools(server, api) {
52
52
  };
53
53
  }
54
54
  });
55
- server.registerTool("read.asset.prices", {
55
+ server.registerTool("read_asset_prices", {
56
56
  annotations: {
57
57
  title: "Get Asset Prices",
58
58
  readOnlyHint: true,
@@ -61,12 +61,12 @@ export function registerAssetTools(server, api) {
61
61
  openWorldHint: true,
62
62
  },
63
63
  description: "Get USD prices for one or more asset addresses. Pass a single address or comma-separated addresses. Returns a price map keyed by address.",
64
- inputSchema: {
64
+ inputSchema: z.object({
65
65
  asset_addresses: z
66
66
  .string()
67
67
  .describe("Single address or comma-separated addresses for price lookup"),
68
68
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
69
- },
69
+ }),
70
70
  outputSchema: AssetPricesOutput,
71
71
  }, async ({ asset_addresses, chain_id }) => {
72
72
  try {
@@ -14,7 +14,7 @@ const TOPICS = {
14
14
  },
15
15
  strategies: {
16
16
  file: "strategies.md",
17
- summary: "Step-by-step strategy templates: delta neutral leveraged LP, protocol owned liquidity, closing sequences",
17
+ summary: "Step-by-step strategy templates: delta neutral leveraged LP, protocol owned liquidity, closing sequences, moving Slipstream positions to Aero",
18
18
  },
19
19
  selection: {
20
20
  file: "selection.md",
@@ -34,7 +34,7 @@ export function registerGuideTools(server) {
34
34
  guides.set(topic, `Guide "${topic}" is not available in this installation.`);
35
35
  }
36
36
  }
37
- server.registerTool("read.guides", {
37
+ server.registerTool("read_guides", {
38
38
  annotations: {
39
39
  title: "Get Guide",
40
40
  readOnlyHint: true,
@@ -43,12 +43,12 @@ export function registerGuideTools(server) {
43
43
  openWorldHint: true,
44
44
  },
45
45
  description: "Get Arcadia workflow guides and reference documentation. Call this before multi-step workflows (opening LP positions, enabling automation, closing positions) or when you need contract addresses, asset manager addresses, or strategy parameters. Topics: overview (addresses + tool catalog), automation (intent-based automation setup), strategies (step-by-step templates), selection (how to evaluate and parameterize strategies).",
46
- inputSchema: {
46
+ inputSchema: z.object({
47
47
  topic: z
48
48
  .enum(TOPIC_KEYS)
49
49
  .optional()
50
50
  .describe("overview = addresses + tool catalog, automation = intent-based automation setup, strategies = step-by-step LP templates, selection = pool evaluation + leverage sizing"),
51
- },
51
+ }),
52
52
  outputSchema: GuideOutput,
53
53
  }, async ({ topic }) => {
54
54
  if (!topic) {
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { PointsLeaderboardOutput } from "../output-schemas.js";
3
3
  export function registerPointsTools(server, api) {
4
- server.registerTool("read.point_leaderboard", {
4
+ server.registerTool("read_point_leaderboard", {
5
5
  annotations: {
6
6
  title: "Get Points Leaderboard",
7
7
  readOnlyHint: true,
@@ -9,11 +9,11 @@ export function registerPointsTools(server, api) {
9
9
  idempotentHint: true,
10
10
  openWorldHint: true,
11
11
  },
12
- description: "Get the Arcadia points leaderboard (paginated). For a specific wallet's points balance, use read.wallet.points.",
13
- inputSchema: {
12
+ description: "Get the Arcadia points leaderboard (paginated). For a specific wallet's points balance, use read_wallet_points.",
13
+ inputSchema: z.object({
14
14
  limit: z.number().default(25).describe("Max leaderboard entries to return (default 25)"),
15
15
  offset: z.number().default(0).describe("Skip first N leaderboard entries for pagination"),
16
- },
16
+ }),
17
17
  outputSchema: PointsLeaderboardOutput,
18
18
  }, async ({ limit, offset }) => {
19
19
  try {
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
4
4
  import { PoolListOutput, PoolDetailOutput } from "../output-schemas.js";
5
5
  export function registerPoolTools(server, api) {
6
- server.registerTool("read.pool.list", {
6
+ server.registerTool("read_pool_list", {
7
7
  annotations: {
8
8
  title: "List Lending Pools",
9
9
  readOnlyHint: true,
@@ -11,10 +11,10 @@ export function registerPoolTools(server, api) {
11
11
  idempotentHint: true,
12
12
  openWorldHint: true,
13
13
  },
14
- description: "List all Arcadia lending pools: TVL, utilization, available liquidity. Key fields: interest_rate = current borrow cost, lending_apy = lender yield. All rates are decimal fractions (1.0 = 100%, 0.06 = 6%). For APY history on a specific pool, use read.pool.info.",
15
- inputSchema: {
14
+ description: "List all Arcadia lending pools: TVL, utilization, available liquidity. Key fields: interest_rate = current borrow cost, lending_apy = lender yield. All rates are decimal fractions (1.0 = 100%, 0.06 = 6%). For APY history on a specific pool, use read_pool_info.",
15
+ inputSchema: z.object({
16
16
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
17
- },
17
+ }),
18
18
  outputSchema: PoolListOutput,
19
19
  }, async ({ chain_id }) => {
20
20
  try {
@@ -47,7 +47,7 @@ export function registerPoolTools(server, api) {
47
47
  };
48
48
  }
49
49
  });
50
- server.registerTool("read.pool.info", {
50
+ server.registerTool("read_pool_info", {
51
51
  annotations: {
52
52
  title: "Get Pool Info",
53
53
  readOnlyHint: true,
@@ -55,12 +55,12 @@ export function registerPoolTools(server, api) {
55
55
  idempotentHint: true,
56
56
  openWorldHint: true,
57
57
  },
58
- description: "Get detailed info for a single lending pool including APY history over time. Useful for analyzing rate trends and comparing pools. Use read.pool.list to discover pool addresses.",
59
- inputSchema: {
58
+ description: "Get detailed info for a single lending pool including APY history over time. Useful for analyzing rate trends and comparing pools. Use read_pool_list to discover pool addresses.",
59
+ inputSchema: z.object({
60
60
  pool_address: z.string().describe("Pool address"),
61
61
  days: z.number().default(14).describe("Number of days of APY history"),
62
62
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
63
- },
63
+ }),
64
64
  outputSchema: PoolDetailOutput,
65
65
  }, async ({ pool_address, days, chain_id }) => {
66
66
  try {
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  import { CHAIN_ID_DESCRIPTION } from "../../config/chains.js";
4
4
  import { StrategyListOutput, StrategyDetailOutput, StrategyRecommendationOutput, } from "../output-schemas.js";
5
5
  export function registerStrategyTools(server, api) {
6
- server.registerTool("read.strategy.list", {
6
+ server.registerTool("read_strategy_list", {
7
7
  annotations: {
8
8
  title: "Get Strategies",
9
9
  readOnlyHint: true,
@@ -11,8 +11,8 @@ export function registerStrategyTools(server, api) {
11
11
  idempotentHint: true,
12
12
  openWorldHint: true,
13
13
  },
14
- description: "Get Arcadia LP strategies. Use featured_only=true for curated top strategies (recommended first call). Returns a paginated list with 7d avg APY for each strategy's default range. Increase limit or use offset for pagination. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%). For full detail on a specific strategy (APY per range width), use read.strategy.info.",
15
- inputSchema: {
14
+ description: "Get Arcadia LP strategies. Use featured_only=true for curated top strategies (recommended first call). Returns a paginated list with 7d avg APY for each strategy's default range. Increase limit or use offset for pagination. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%). For full detail on a specific strategy (APY per range width), use read_strategy_info.",
15
+ inputSchema: z.object({
16
16
  featured_only: z
17
17
  .boolean()
18
18
  .default(false)
@@ -20,7 +20,7 @@ export function registerStrategyTools(server, api) {
20
20
  limit: z.number().default(25).describe("Max strategies to return (default 25)"),
21
21
  offset: z.number().default(0).describe("Skip first N strategies for pagination"),
22
22
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
23
- },
23
+ }),
24
24
  outputSchema: StrategyListOutput,
25
25
  }, async ({ featured_only, limit, offset, chain_id }) => {
26
26
  try {
@@ -106,7 +106,7 @@ export function registerStrategyTools(server, api) {
106
106
  };
107
107
  }
108
108
  });
109
- server.registerTool("read.strategy.info", {
109
+ server.registerTool("read_strategy_info", {
110
110
  annotations: {
111
111
  title: "Get Strategy Info",
112
112
  readOnlyHint: true,
@@ -114,11 +114,11 @@ export function registerStrategyTools(server, api) {
114
114
  idempotentHint: true,
115
115
  openWorldHint: true,
116
116
  },
117
- description: "Get full detail for a specific LP strategy by ID — includes APY per range width (narrower range = higher APY but more rebalancing cost/risk), pool info, and configuration. Use read.strategy.list to discover strategy IDs. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%).",
118
- inputSchema: {
117
+ description: "Get full detail for a specific LP strategy by ID: includes APY per range width (narrower range = higher APY but more rebalancing cost/risk), pool info, and configuration. Use read_strategy_list to discover strategy IDs. All APY values are decimal fractions (1.0 = 100%, 0.05 = 5%).",
118
+ inputSchema: z.object({
119
119
  strategy_id: z.number().describe("Strategy ID"),
120
120
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
121
- },
121
+ }),
122
122
  outputSchema: StrategyDetailOutput,
123
123
  }, async ({ strategy_id, chain_id }) => {
124
124
  try {
@@ -140,7 +140,7 @@ export function registerStrategyTools(server, api) {
140
140
  };
141
141
  }
142
142
  });
143
- server.registerTool("read.strategy.recommendation", {
143
+ server.registerTool("read_strategy_recommendation", {
144
144
  annotations: {
145
145
  title: "Get Recommendation",
146
146
  readOnlyHint: true,
@@ -148,11 +148,11 @@ export function registerStrategyTools(server, api) {
148
148
  idempotentHint: true,
149
149
  openWorldHint: true,
150
150
  },
151
- description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like read.strategy.list), so recommended strategies may differ from the list ranking. APY values are decimal fractions (0.05 = 5%). weekly_earning_difference is in USD.",
152
- inputSchema: {
151
+ description: "Get a rebalancing recommendation for an Arcadia account: suggests asset changes to optimize yield. Uses 1d APY (not 7d like read_strategy_list), so recommended strategies may differ from the list ranking. APY values are decimal fractions (0.05 = 5%). weekly_earning_difference is in USD.",
152
+ inputSchema: z.object({
153
153
  account_address: z.string().describe("Arcadia account address"),
154
154
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
155
- },
155
+ }),
156
156
  outputSchema: StrategyRecommendationOutput,
157
157
  }, async ({ account_address, chain_id }) => {
158
158
  try {
@@ -7,7 +7,7 @@ import { validateAddress, validateChainId } from "../../utils/validation.js";
7
7
  import { WalletBalancesOutput, WalletAllowanceOutput, AccountListOutput, PointsWalletOutput, } from "../output-schemas.js";
8
8
  const MAX_UINT256 = 2n ** 256n - 1n;
9
9
  export function registerWalletTools(server, chains, api) {
10
- server.registerTool("read.wallet.balances", {
10
+ server.registerTool("read_wallet_balances", {
11
11
  annotations: {
12
12
  title: "Get Wallet Balances",
13
13
  readOnlyHint: true,
@@ -15,12 +15,12 @@ export function registerWalletTools(server, chains, api) {
15
15
  idempotentHint: true,
16
16
  openWorldHint: true,
17
17
  },
18
- description: "Get native ETH and ERC20 token balances for a wallet address. Reads directly from chain via RPC multicall. Use before write.account.add_liquidity or write.account.deposit to verify the wallet has sufficient tokens. Returns both raw balance (smallest unit/wei) and formatted (human-readable) per token.",
19
- inputSchema: {
18
+ description: "Get native ETH and ERC20 token balances for a wallet address. Reads directly from chain via RPC multicall. Use before write_account_add_liquidity or write_account_deposit to verify the wallet has sufficient tokens. Returns both raw balance (smallest unit/wei) and formatted (human-readable) per token.",
19
+ inputSchema: z.object({
20
20
  wallet_address: z.string().describe("Wallet address to check balances for"),
21
21
  token_addresses: z.array(z.string()).describe("ERC20 token contract addresses to check"),
22
22
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
23
- },
23
+ }),
24
24
  outputSchema: WalletBalancesOutput,
25
25
  }, async ({ wallet_address, token_addresses, chain_id }) => {
26
26
  try {
@@ -83,7 +83,7 @@ export function registerWalletTools(server, chains, api) {
83
83
  };
84
84
  }
85
85
  });
86
- server.registerTool("read.wallet.allowances", {
86
+ server.registerTool("read_wallet_allowances", {
87
87
  annotations: {
88
88
  title: "Get Token Allowances",
89
89
  readOnlyHint: true,
@@ -91,15 +91,15 @@ export function registerWalletTools(server, chains, api) {
91
91
  idempotentHint: true,
92
92
  openWorldHint: true,
93
93
  },
94
- description: "Check ERC20 token allowances for a spender address. Use before write.wallet.approve to avoid redundant approvals — skip approving if the current allowance is already sufficient.",
95
- inputSchema: {
94
+ description: "Check ERC20 token allowances for a spender address. Use before write_wallet_approve to avoid redundant approvals: skip approving if the current allowance is already sufficient.",
95
+ inputSchema: z.object({
96
96
  owner_address: z.string().describe("Token owner address (the wallet granting approval)"),
97
97
  spender_address: z
98
98
  .string()
99
99
  .describe("Spender address to check allowance for (e.g. Arcadia account address)"),
100
100
  token_addresses: z.array(z.string()).describe("ERC20 token contract addresses to check"),
101
101
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
102
- },
102
+ }),
103
103
  outputSchema: WalletAllowanceOutput,
104
104
  }, async ({ owner_address, spender_address, token_addresses, chain_id }) => {
105
105
  try {
@@ -151,7 +151,7 @@ export function registerWalletTools(server, chains, api) {
151
151
  };
152
152
  }
153
153
  });
154
- server.registerTool("read.wallet.accounts", {
154
+ server.registerTool("read_wallet_accounts", {
155
155
  annotations: {
156
156
  title: "List Wallet Accounts",
157
157
  readOnlyHint: true,
@@ -159,11 +159,11 @@ export function registerWalletTools(server, chains, api) {
159
159
  idempotentHint: true,
160
160
  openWorldHint: true,
161
161
  },
162
- description: "List all Arcadia accounts owned by a wallet address. Returns a summary of each account (address, name). Call read.account.info with a specific account_address for full details like health factor, collateral, and debt.",
163
- inputSchema: {
162
+ description: "List all Arcadia accounts owned by a wallet address. Returns a summary of each account (address, name). Call read_account_info with a specific account_address for full details like health factor, collateral, and debt.",
163
+ inputSchema: z.object({
164
164
  wallet_address: z.string().describe("Wallet address to list accounts for"),
165
165
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
166
- },
166
+ }),
167
167
  outputSchema: AccountListOutput,
168
168
  }, async ({ wallet_address, chain_id }) => {
169
169
  try {
@@ -187,7 +187,7 @@ export function registerWalletTools(server, chains, api) {
187
187
  };
188
188
  }
189
189
  });
190
- server.registerTool("read.wallet.points", {
190
+ server.registerTool("read_wallet_points", {
191
191
  annotations: {
192
192
  title: "Get Wallet Points",
193
193
  readOnlyHint: true,
@@ -196,9 +196,9 @@ export function registerWalletTools(server, chains, api) {
196
196
  openWorldHint: true,
197
197
  },
198
198
  description: "Get Arcadia points balance for a specific wallet address.",
199
- inputSchema: {
199
+ inputSchema: z.object({
200
200
  wallet_address: z.string().describe("Wallet address to get points for"),
201
- },
201
+ }),
202
202
  outputSchema: PointsWalletOutput,
203
203
  }, async ({ wallet_address }) => {
204
204
  try {
@@ -13,7 +13,7 @@ function formatTokenAmount(value, decimals, maxFrac = 8) {
13
13
  return frac ? `${whole}.${frac}` : whole;
14
14
  }
15
15
  export function registerAddLiquidityTool(server, api, chains) {
16
- server.registerTool("write.account.add_liquidity", {
16
+ server.registerTool("write_account_add_liquidity", {
17
17
  annotations: {
18
18
  title: "Build Add Liquidity Transaction",
19
19
  readOnlyHint: false,
@@ -22,15 +22,15 @@ export function registerAddLiquidityTool(server, api, chains) {
22
22
  openWorldHint: true,
23
23
  },
24
24
  outputSchema: BatchedTransactionOutput,
25
- description: "Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write.account.deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read.wallet.allowances), then approve if needed (write.wallet.approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read.guides('strategies'). The returned calldata is time-sensitive — sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture.",
26
- inputSchema: {
25
+ description: "Multi-step flash-action: atomically combines [deposit from wallet] + [use account collateral] + [swap to optimal ratio] + [mint LP] + [borrow if leveraged] in ONE transaction. Do NOT call write_account_deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read_wallet_allowances), then approve if needed (write_wallet_approve). Supports depositing multiple tokens and minting multiple LP positions in one tx. Works with both margin accounts (can leverage) and spot accounts (no leverage). For workflows, call read_guides('strategies'). The returned calldata is time-sensitive: sign and broadcast within 30 seconds. If the transaction reverts due to price movement, rebuild and sign again immediately (retry at least once before giving up). Response includes tenderly_sim_url and tenderly_sim_status for pre-broadcast validation. expected_value_change is in raw units of the account's numeraire token (6 decimals for USDC, 18 for WETH). Negative = cost to open, positive = value gained. Compare before.total_account_value and after.total_account_value for the full picture.",
26
+ inputSchema: z.object({
27
27
  account_address: z.string().describe("Arcadia account address"),
28
28
  wallet_address: z.string().describe("Wallet address of the account owner"),
29
29
  positions: z
30
30
  .array(z.object({
31
31
  strategy_id: z
32
32
  .number()
33
- .describe("From read.strategy.list (or read.strategy.info for full range detail)"),
33
+ .describe("From read_strategy_list (or read_strategy_info for full range detail)"),
34
34
  tick_lower: z
35
35
  .number()
36
36
  .optional()
@@ -51,7 +51,7 @@ export function registerAddLiquidityTool(server, api, chains) {
51
51
  .describe("Token decimals (e.g. 6 for USDC, 18 for WETH). Default 18."),
52
52
  }))
53
53
  .optional()
54
- .describe("Wallet tokens to deposit. Approve each token first (write.wallet.approve). Omit to use only account collateral."),
54
+ .describe("Wallet tokens to deposit. Approve each token first (write_wallet_approve). Omit to use only account collateral."),
55
55
  use_account_assets: z
56
56
  .boolean()
57
57
  .optional()
@@ -64,7 +64,7 @@ export function registerAddLiquidityTool(server, api, chains) {
64
64
  .describe("0 = no borrow, 2 = 2x leverage. Margin accounts only."),
65
65
  slippage: z.number().optional().default(100).describe("Basis points, 100 = 1%"),
66
66
  chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
67
- },
67
+ }),
68
68
  }, async ({ account_address, wallet_address, positions, deposits: walletDeposits, use_account_assets, leverage, slippage, chain_id, }) => {
69
69
  try {
70
70
  const validChainId = validateChainId(chain_id);
@@ -127,7 +127,7 @@ export function registerAddLiquidityTool(server, api, chains) {
127
127
  content: [
128
128
  {
129
129
  type: "text",
130
- text: "Error: Spot accounts cannot borrow. Set leverage to 0, or create a margin account (V3) with a creditor (lending pool) using write.account.create.",
130
+ text: "Error: Spot accounts cannot borrow. Set leverage to 0, or create a margin account (V3) with a creditor (lending pool) using write_account_create.",
131
131
  },
132
132
  ],
133
133
  isError: true,
@@ -216,7 +216,7 @@ export function registerAddLiquidityTool(server, api, chains) {
216
216
  content: [
217
217
  {
218
218
  type: "text",
219
- text: "Error: use_account_assets=true but account overview is unavailable and no wallet deposits were provided. Provide deposits or deposit assets first via write.account.deposit.",
219
+ text: "Error: use_account_assets=true but account overview is unavailable and no wallet deposits were provided. Provide deposits or deposit assets first via write_account_deposit.",
220
220
  },
221
221
  ],
222
222
  isError: true,
@@ -228,7 +228,7 @@ export function registerAddLiquidityTool(server, api, chains) {
228
228
  content: [
229
229
  {
230
230
  type: "text",
231
- text: "Error: use_account_assets=true but the account has no deposited assets, and no wallet deposits were provided. Deposit assets first via write.account.deposit or provide deposits.",
231
+ text: "Error: use_account_assets=true but the account has no deposited assets, and no wallet deposits were provided. Deposit assets first via write_account_deposit or provide deposits.",
232
232
  },
233
233
  ],
234
234
  isError: true,