@arcadia-finance/mcp-server 0.1.5 → 0.2.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.
package/README.md CHANGED
@@ -22,42 +22,42 @@ Designed for AI agents (Claude, Cursor, etc.) to interact with Arcadia onchain.
22
22
 
23
23
  ### Read Tools
24
24
 
25
- | Tool | Description |
26
- | --------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
27
- | `get_account_info` | Account overview: health factor, collateral, debt, positions, liquidation price. Pass `account_address` or `wallet_address`. |
28
- | `get_account_history` | Historical account value over time. |
29
- | `get_account_pnl` | PnL and yield data for an account. |
30
- | `get_assets` | Supported collateral assets with addresses, types, decimals. Optional USD price lookup. |
31
- | `get_wallet_balances` | On-chain ERC20 balances and native ETH for a wallet address. |
32
- | `get_allowance` | Check ERC20 token allowances for a spender. Use before `build_approve_tx` to avoid redundant approvals. |
33
- | `get_points` | Points balance for a wallet, or leaderboard. |
34
- | `get_lending_pools` | Pool data: TVL, APY, utilization, liquidity. Optional single-pool detail with APY history. |
35
- | `get_strategies` | LP strategies with APY, underlyings, pool info. Optional detail or featured filter. |
36
- | `get_recommendation` | Rebalancing recommendation for an account. |
37
- | `get_guide` | Reference guides: automation setup, strategy selection, strategy templates. |
25
+ | Tool | Description |
26
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
27
+ | `read.account_info` | Account overview: health factor, collateral, debt, positions, liquidation price. Pass `account_address` or `wallet_address`. |
28
+ | `read.account_history` | Historical account value over time. |
29
+ | `read.account_pnl` | PnL and yield data for an account. |
30
+ | `read.assets` | Supported collateral assets with addresses, types, decimals. Optional USD price lookup. |
31
+ | `read.wallet_balances` | On-chain ERC20 balances and native ETH for a wallet address. |
32
+ | `read.allowance` | Check ERC20 token allowances for a spender. Use before `write.approve` to avoid redundant approvals. |
33
+ | `read.points` | Points balance for a wallet, or leaderboard. |
34
+ | `read.lending_pools` | Pool data: TVL, APY, utilization, liquidity. Optional single-pool detail with APY history. |
35
+ | `read.strategies` | LP strategies with APY, underlyings, pool info. Optional detail or featured filter. |
36
+ | `read.recommendation` | Rebalancing recommendation for an account. |
37
+ | `read.guide` | Reference guides: automation setup, strategy selection, strategy templates. |
38
38
 
39
39
  ### Write Tools
40
40
 
41
41
  Direct calldata encoding via viem. Each returns `{ to, data, value, chainId }`.
42
42
 
43
- | Tool | Description |
44
- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
45
- | `build_approve_tx` | Approve an ERC20 token for spending. Required before depositing into an account. Call `get_allowance` first to check if already approved. |
46
- | `build_create_account_tx` | Create a new Arcadia account via Factory. |
47
- | `build_deposit_tx` | Deposit ERC20 tokens into an account. |
48
- | `build_withdraw_tx` | Withdraw assets from an account. |
49
- | `build_borrow_tx` | Borrow from a lending pool. |
50
- | `build_repay_tx` | Repay debt to a lending pool. |
51
- | `build_set_asset_manager_tx` | Grant or revoke an asset manager contract's permission on a V3/V4 account. For full setup with config, use `build_configure_asset_manager_tx`. |
52
- | `build_configure_asset_manager_tx` | Enable AND configure an asset manager in one tx for V3/V4 accounts: sets initiator, fee limits, and strategy parameters (trigger thresholds, compound mode, recipients). |
43
+ | Tool | Description |
44
+ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
45
+ | `write.approve` | Approve an ERC20 token for spending. Required before depositing into an account. Call `read.allowance` first to check if already approved. |
46
+ | `write.create_account` | Create a new Arcadia account via Factory. |
47
+ | `write.deposit` | Deposit ERC20 tokens into an account. |
48
+ | `write.withdraw` | Withdraw assets from an account. |
49
+ | `write.borrow` | Borrow from a lending pool. |
50
+ | `write.repay` | Repay debt to a lending pool. |
51
+ | `write.set_asset_manager` | Grant or revoke an asset manager contract's permission on a V3/V4 account. For full setup with config, use `write.configure_asset_manager`. |
52
+ | `write.configure_asset_manager` | Enable AND configure an asset manager in one tx for V3/V4 accounts: sets initiator, fee limits, and strategy parameters (trigger thresholds, compound mode, recipients). |
53
53
 
54
54
  ### Dev Tools
55
55
 
56
56
  Always registered but requires `PK` env var to function.
57
57
 
58
- | Tool | Description |
59
- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
60
- | `sign_and_send_tx` | Sign and broadcast an unsigned transaction using a local private key (`PK` env var). Not for production — use a dedicated wallet MCP server instead. |
58
+ | Tool | Description |
59
+ | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
60
+ | `dev.sign_and_send` | Sign and broadcast an unsigned transaction using a local private key (`PK` env var). Not for production — use a dedicated wallet MCP server instead. |
61
61
 
62
62
  ### Advanced Tools
63
63
 
@@ -65,12 +65,12 @@ Proxied via backend API. Handles swap routing, Tenderly simulation, optimal rati
65
65
 
66
66
  | Tool | Description |
67
67
  | -------------------------------- | ----------------------------------------------------------------------- |
68
- | `build_add_liquidity_tx` | Flash-action: deposit + swap + mint LP + optional leverage, atomically. |
69
- | `build_remove_liquidity_tx` | Remove/decrease LP position liquidity. |
70
- | `build_swap_tx` | Swap assets within an account (backend-routed). |
71
- | `build_repay_with_collateral_tx` | Repay debt by selling collateral (swap + repay in one tx). |
72
- | `build_close_position_tx` | Atomic close: burn LP + swap + repay debt in one tx. |
73
- | `build_position_action_tx` | Stake, unstake, or claim rewards for LP positions. |
68
+ | `advanced.add_liquidity` | Flash-action: deposit + swap + mint LP + optional leverage, atomically. |
69
+ | `advanced.remove_liquidity` | Remove/decrease LP position liquidity. |
70
+ | `advanced.swap` | Swap assets within an account (backend-routed). |
71
+ | `advanced.repay_with_collateral` | Repay debt by selling collateral (swap + repay in one tx). |
72
+ | `advanced.close_position` | Atomic close: burn LP + swap + repay debt in one tx. |
73
+ | `advanced.position_action` | Stake, unstake, or claim rewards for LP positions. |
74
74
 
75
75
  ## Transaction Signing
76
76
 
@@ -91,11 +91,11 @@ import { base } from "viem/chains";
91
91
  const account = privateKeyToAccount("0x...");
92
92
  const client = createWalletClient({ account, chain: base, transport: http() });
93
93
 
94
- // tx = result from any build_*_tx tool
94
+ // tx = result from any write.* or advanced.* tool
95
95
  const hash = await client.sendTransaction(tx);
96
96
  ```
97
97
 
98
- **Built-in `sign_and_send_tx` tool (development only):**
98
+ **Built-in `dev.sign_and_send` tool (development only):**
99
99
  The server includes a dev-only signing tool that reads a private key from the `PK` environment variable. Set `PK` via a `.env` file or your MCP client config:
100
100
 
101
101
  ```bash
@@ -124,7 +124,7 @@ yarn build
124
124
  | `RPC_URL_BASE` | No | RPC URL for Base (8453). Falls back to public RPC if not set. |
125
125
  | `RPC_URL_OPTIMISM` | No | RPC URL for Optimism (10). Falls back to public RPC if not set. |
126
126
  | `RPC_URL_UNICHAIN` | No | RPC URL for Unichain (130). Falls back to public RPC if not set. |
127
- | `PK` | No | Private key (hex) for dev-only `sign_and_send_tx` tool. |
127
+ | `PK` | No | Private key (hex) for dev-only `dev.sign_and_send` tool. |
128
128
 
129
129
  **Supported chains:** Base (8453), Optimism (10), Unichain (130)
130
130
 
@@ -28,7 +28,7 @@ export class ArcadiaApiClient {
28
28
  }
29
29
  else if (status === 500) {
30
30
  hint =
31
- " Internal backend error. Common causes: account has no creditor (spot account used where margin required), position does not exist in the account, unsupported asset type, or transient issue. Verify account and position details with get_account_info, then retry once.";
31
+ " Internal backend error. Common causes: account has no creditor (spot account used where margin required), position does not exist in the account, unsupported asset type, or transient issue. Verify account and position details with read.account_info, then retry once.";
32
32
  }
33
33
  else if (status === 502 || status === 503 || status === 504) {
34
34
  hint = " Backend is temporarily unavailable. Retry after a few seconds.";
@@ -16,10 +16,10 @@ export function registerWorkflowPrompts(server) {
16
16
  `Analyze Arcadia account ${account_address} on chain ${chain_id ?? "8453"}.`,
17
17
  "",
18
18
  "Steps:",
19
- "1. Call get_account_info to get health factor, collateral, debt, positions, and automation status",
20
- "2. Call get_account_pnl to check profitability and yield earned",
21
- "3. If leveraged (health_factor < 1), call get_lending_pools to compare borrow APY vs fee APY",
22
- "4. Call get_recommendation to check if rebalancing is needed",
19
+ "1. Call read.account_info to get health factor, collateral, debt, positions, and automation status",
20
+ "2. Call read.account_pnl to check profitability and yield earned",
21
+ "3. If leveraged (health_factor < 1), call read.lending_pools to compare borrow APY vs fee APY",
22
+ "4. Call read.recommendation to check if rebalancing is needed",
23
23
  "",
24
24
  "Provide a summary covering:",
25
25
  "- Health factor interpretation (1 = no debt/safest, >0.5 = healthy, <0.5 = monitor, <0.2 = action needed)",
@@ -48,9 +48,9 @@ export function registerWorkflowPrompts(server) {
48
48
  `Find the best yield strategy on Arcadia (chain ${chain_id ?? "8453"})${deposit_token ? ` for depositing ${deposit_token}` : ""}.`,
49
49
  "",
50
50
  "Steps:",
51
- "1. Call get_strategies(featured_only: true) to see top LP strategies with fee APY",
52
- "2. Call get_strategies(strategy_id: <id>) for promising ones to see APY per range width",
53
- "3. Call get_lending_pools to check borrow APY for leveraged strategies",
51
+ "1. Call read.strategies(featured_only: true) to see top LP strategies with fee APY",
52
+ "2. Call read.strategies(strategy_id: <id>) for promising ones to see APY per range width",
53
+ "3. Call read.lending_pools to check borrow APY for leveraged strategies",
54
54
  "4. Evaluate: net_APY = fee_APY - (leverage - 1) * borrow_APY > 0?",
55
55
  "",
56
56
  "For each viable strategy, assess:",
@@ -81,9 +81,9 @@ export function registerWorkflowPrompts(server) {
81
81
  `Set up automation for Arcadia account ${account_address} on chain ${chain_id ?? "8453"}.`,
82
82
  "",
83
83
  "Steps:",
84
- "1. Call get_account_info to check current positions and which asset managers are already enabled",
84
+ "1. Call read.account_info to check current positions and which asset managers are already enabled",
85
85
  "2. Identify the LP protocol (Slipstream V1/V2, Uniswap V3/V4) from the position",
86
- "3. For each automation type to enable, use build_configure_asset_manager_tx:",
86
+ "3. For each automation type to enable, use write.configure_asset_manager:",
87
87
  " - Rebalancer: match to LP protocol, set trigger ratios and compound_leftovers",
88
88
  " - Compounder: match to LP protocol (compounds fees between rebalances)",
89
89
  " - Yield Claimer: match to LP protocol, set fee_recipient",
@@ -11,7 +11,7 @@ function formatTokenAmount(value, decimals, maxFrac = 8) {
11
11
  return frac ? `${whole}.${frac}` : whole;
12
12
  }
13
13
  export function registerAddLiquidityTool(server, api, chains) {
14
- server.registerTool("build_add_liquidity_tx", {
14
+ server.registerTool("advanced.add_liquidity", {
15
15
  annotations: {
16
16
  title: "Build Add Liquidity Transaction",
17
17
  readOnlyHint: false,
@@ -19,13 +19,13 @@ export function registerAddLiquidityTool(server, api, chains) {
19
19
  idempotentHint: true,
20
20
  openWorldHint: true,
21
21
  },
22
- 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 build_deposit_tx separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (get_allowance), then approve if needed (build_approve_tx). 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 get_guide('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 the estimated slippage/fee cost in the account's numeraire token (raw wei units, e.g. 18 decimals for WETH). Compare before.total_account_value and after.total_account_value for the full picture.",
22
+ 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.deposit separately. Capital sources: wallet tokens (deposits array), existing account collateral (use_account_assets=true), or both. Check allowances first (read.allowance), then approve if needed (write.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.guide('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 the estimated slippage/fee cost in the account's numeraire token (raw wei units, e.g. 18 decimals for WETH). Compare before.total_account_value and after.total_account_value for the full picture.",
23
23
  inputSchema: {
24
24
  account_address: z.string().describe("Arcadia account address"),
25
25
  wallet_address: z.string().describe("Wallet address of the account owner"),
26
26
  positions: z
27
27
  .array(z.object({
28
- strategy_id: z.number().describe("From get_strategies tool"),
28
+ strategy_id: z.number().describe("From read.strategies tool"),
29
29
  tick_lower: z
30
30
  .number()
31
31
  .optional()
@@ -46,7 +46,7 @@ export function registerAddLiquidityTool(server, api, chains) {
46
46
  .describe("Token decimals (e.g. 6 for USDC, 18 for WETH). Default 18."),
47
47
  }))
48
48
  .optional()
49
- .describe("Wallet tokens to deposit. Approve each token first (build_approve_tx). Omit to use only account collateral."),
49
+ .describe("Wallet tokens to deposit. Approve each token first (write.approve). Omit to use only account collateral."),
50
50
  use_account_assets: z
51
51
  .boolean()
52
52
  .optional()
@@ -122,7 +122,7 @@ export function registerAddLiquidityTool(server, api, chains) {
122
122
  content: [
123
123
  {
124
124
  type: "text",
125
- text: "Error: Spot accounts cannot borrow. Set leverage to 0, or create a margin account (V3) with a creditor (lending pool) using build_create_account_tx.",
125
+ text: "Error: Spot accounts cannot borrow. Set leverage to 0, or create a margin account (V3) with a creditor (lending pool) using write.create_account.",
126
126
  },
127
127
  ],
128
128
  isError: true,
@@ -211,7 +211,7 @@ export function registerAddLiquidityTool(server, api, chains) {
211
211
  content: [
212
212
  {
213
213
  type: "text",
214
- text: "Error: use_account_assets=true but account overview is unavailable and no wallet deposits were provided. Provide deposits or deposit assets first via build_deposit_tx.",
214
+ 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.deposit.",
215
215
  },
216
216
  ],
217
217
  isError: true,
@@ -223,7 +223,7 @@ export function registerAddLiquidityTool(server, api, chains) {
223
223
  content: [
224
224
  {
225
225
  type: "text",
226
- text: "Error: use_account_assets=true but the account has no deposited assets, and no wallet deposits were provided. Deposit assets first via build_deposit_tx or provide deposits.",
226
+ text: "Error: use_account_assets=true but the account has no deposited assets, and no wallet deposits were provided. Deposit assets first via write.deposit or provide deposits.",
227
227
  },
228
228
  ],
229
229
  isError: true,
@@ -4,7 +4,7 @@ import { readAccountMetadata } from "./account-metadata.js";
4
4
  import { formatAdvancedResponse } from "./format-response.js";
5
5
  import { validateAddress, validateChainId } from "../../utils/validation.js";
6
6
  export function registerClosePositionTool(server, api, chains) {
7
- server.registerTool("build_close_position_tx", {
7
+ server.registerTool("advanced.close_position", {
8
8
  annotations: {
9
9
  title: "Build Close Position Transaction",
10
10
  readOnlyHint: false,
@@ -12,13 +12,13 @@ export function registerClosePositionTool(server, api, chains) {
12
12
  idempotentHint: true,
13
13
  openWorldHint: true,
14
14
  },
15
- description: `Atomic flash-action that closes an Arcadia account position in ONE transaction. Combines up to 3 steps atomically: [burn LP position] + [swap all tokens to a single target asset] + [repay debt]. Tokens remain in the account after closing — use build_withdraw_tx to send them to your wallet.
15
+ description: `Atomic flash-action that closes an Arcadia account position in ONE transaction. Combines up to 3 steps atomically: [burn LP position] + [swap all tokens to a single target asset] + [repay debt]. Tokens remain in the account after closing — use write.withdraw to send them to your wallet.
16
16
 
17
- ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (build_remove_liquidity_tx, build_swap_tx, build_repay_with_collateral_tx, build_withdraw_tx) if this tool fails.
17
+ ALWAYS try this tool first when closing/exiting a position. Only fall back to individual tools (advanced.remove_liquidity, advanced.swap, advanced.repay_with_collateral, write.withdraw) if this tool fails.
18
18
 
19
19
  Supports two modes:
20
20
  - close_lp_only=true: Burns LP and leaves underlying tokens in the account. Use as step 1 if the full close fails, then call again with close_lp_only=false to swap+repay the remaining tokens.
21
- - close_lp_only=false (default): Full atomic close — burns LP, swaps everything to receive_assets, repays debt. Remaining tokens stay in the account. Follow up with build_withdraw_tx to send to wallet. Supports multiple receive assets with custom distribution.
21
+ - close_lp_only=false (default): Full atomic close — burns LP, swaps everything to receive_assets, repays debt. Remaining tokens stay in the account. Follow up with write.withdraw to send to wallet. Supports multiple receive assets with custom distribution.
22
22
 
23
23
  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.`,
24
24
  inputSchema: {
@@ -30,7 +30,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
30
30
  amount: z.string().describe("Amount to sell (use '1' for NFT positions)"),
31
31
  decimals: z.number().describe("Token decimals (use 1 for NFT positions)"),
32
32
  }))
33
- .describe("Assets to close/sell from the account. For LP positions: asset_address = position manager, asset_id = NFT ID, amount = '1', decimals = 1. For ERC20 tokens: asset_id = 0, amount = full balance, decimals = token decimals. Get these from get_account_info."),
33
+ .describe("Assets to close/sell from the account. For LP positions: asset_address = position manager, asset_id = NFT ID, amount = '1', decimals = 1. For ERC20 tokens: asset_id = 0, amount = full balance, decimals = token decimals. Get these from read.account_info."),
34
34
  receive_assets: z
35
35
  .array(z.object({
36
36
  asset_address: z.string().describe("Target token address (e.g. USDC, WETH)"),
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { formatAdvancedResponse } from "./format-response.js";
3
3
  import { validateAddress } from "../../utils/validation.js";
4
4
  export function registerPositionActionsTool(server, api) {
5
- server.registerTool("build_position_action_tx", {
5
+ server.registerTool("advanced.position_action", {
6
6
  annotations: {
7
7
  title: "Build Position Action Transaction",
8
8
  readOnlyHint: false,
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { formatAdvancedResponse } from "./format-response.js";
3
3
  import { validateAddress } from "../../utils/validation.js";
4
4
  export function registerRemoveLiquidityTool(server, api) {
5
- server.registerTool("build_remove_liquidity_tx", {
5
+ server.registerTool("advanced.remove_liquidity", {
6
6
  annotations: {
7
7
  title: "Build Remove Liquidity Transaction",
8
8
  readOnlyHint: false,
@@ -12,7 +12,7 @@ export function registerRemoveLiquidityTool(server, api) {
12
12
  },
13
13
  description: `Flash-action: PARTIALLY decreases liquidity from an LP position. The position remains open with reduced liquidity; underlying tokens stay in the account.
14
14
 
15
- For FULL position exit (burn LP + swap + repay + withdraw), use build_close_position_tx instead — it batches everything into one atomic transaction.
15
+ For FULL position exit (burn LP + swap + repay + withdraw), use advanced.close_position instead — it batches everything into one atomic transaction.
16
16
 
17
17
  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.`,
18
18
  inputSchema: {
@@ -21,7 +21,7 @@ The returned calldata is time-sensitive — sign and broadcast within 30 seconds
21
21
  asset_id: z.number().describe("NFT token ID"),
22
22
  adjustment: z
23
23
  .string()
24
- .describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity — for full removal use build_close_position_tx."),
24
+ .describe("Liquidity amount to remove (raw uint128 value as string). Must be less than total liquidity — for full removal use advanced.close_position."),
25
25
  chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
26
26
  },
27
27
  }, async ({ account_address, asset_address, asset_id, adjustment, chain_id }) => {
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { formatAdvancedResponse } from "./format-response.js";
3
3
  import { validateAddress } from "../../utils/validation.js";
4
4
  export function registerRepayWithCollateralTool(server, api) {
5
- server.registerTool("build_repay_with_collateral_tx", {
5
+ server.registerTool("advanced.repay_with_collateral", {
6
6
  annotations: {
7
7
  title: "Build Repay With Collateral Transaction",
8
8
  readOnlyHint: false,
@@ -10,7 +10,7 @@ export function registerRepayWithCollateralTool(server, api) {
10
10
  idempotentHint: true,
11
11
  openWorldHint: true,
12
12
  },
13
- description: "Multi-step flash-action: swaps account collateral to debt token and repays in one atomic transaction. To repay from wallet instead, use build_repay_tx. NOTE: If you are closing a position (remove LP + swap + repay + withdraw), prefer build_close_position_tx which batches everything atomically. Only use this tool for standalone repayment while keeping the position active. 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.",
13
+ description: "Multi-step flash-action: swaps account collateral to debt token and repays in one atomic transaction. To repay from wallet instead, use write.repay. NOTE: If you are closing a position (remove LP + swap + repay + withdraw), prefer advanced.close_position which batches everything atomically. Only use this tool for standalone repayment while keeping the position active. 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.",
14
14
  inputSchema: {
15
15
  account_address: z.string().describe("Arcadia account address"),
16
16
  amount_in: z.string().describe("Collateral amount to sell"),
@@ -2,7 +2,7 @@ import { z } from "zod";
2
2
  import { formatAdvancedResponse } from "./format-response.js";
3
3
  import { validateAddress } from "../../utils/validation.js";
4
4
  export function registerSwapTool(server, api) {
5
- server.registerTool("build_swap_tx", {
5
+ server.registerTool("advanced.swap", {
6
6
  annotations: {
7
7
  title: "Build Swap Transaction",
8
8
  readOnlyHint: false,
@@ -10,7 +10,7 @@ export function registerSwapTool(server, api) {
10
10
  idempotentHint: true,
11
11
  openWorldHint: true,
12
12
  },
13
- description: "Flash-action: swaps assets within an Arcadia account in one atomic transaction. The backend finds the optimal swap route. NOTE: If you are closing a position (swap + repay + withdraw), prefer build_close_position_tx which batches everything atomically. Only use this tool for standalone swaps within an active position. 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.",
13
+ description: "Flash-action: swaps assets within an Arcadia account in one atomic transaction. The backend finds the optimal swap route. NOTE: If you are closing a position (swap + repay + withdraw), prefer advanced.close_position which batches everything atomically. Only use this tool for standalone swaps within an active position. 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.",
14
14
  inputSchema: {
15
15
  account_address: z.string().describe("Arcadia account address"),
16
16
  asset_from: z.string().describe("Token address to swap from"),
@@ -37,7 +37,7 @@ function trimOverview(overview) {
37
37
  return trimmed;
38
38
  }
39
39
  export function registerAccountTools(server, api, chains) {
40
- server.registerTool("get_account_info", {
40
+ server.registerTool("read.account_info", {
41
41
  annotations: {
42
42
  title: "Get Account Info",
43
43
  readOnlyHint: true,
@@ -180,7 +180,7 @@ export function registerAccountTools(server, api, chains) {
180
180
  };
181
181
  }
182
182
  });
183
- server.registerTool("get_account_history", {
183
+ server.registerTool("read.account_history", {
184
184
  annotations: {
185
185
  title: "Get Account History",
186
186
  readOnlyHint: true,
@@ -211,7 +211,7 @@ export function registerAccountTools(server, api, chains) {
211
211
  };
212
212
  }
213
213
  });
214
- server.registerTool("get_account_pnl", {
214
+ server.registerTool("read.account_pnl", {
215
215
  annotations: {
216
216
  title: "Get Account PnL",
217
217
  readOnlyHint: true,
@@ -5,7 +5,7 @@ import { getPublicClient } from "../../clients/chain.js";
5
5
  import { validateAddress, validateChainId } from "../../utils/validation.js";
6
6
  const MAX_UINT256 = 2n ** 256n - 1n;
7
7
  export function registerAllowanceTools(server, chains) {
8
- server.registerTool("get_allowance", {
8
+ server.registerTool("read.allowance", {
9
9
  annotations: {
10
10
  title: "Get Token Allowance",
11
11
  readOnlyHint: true,
@@ -13,7 +13,7 @@ export function registerAllowanceTools(server, chains) {
13
13
  idempotentHint: true,
14
14
  openWorldHint: true,
15
15
  },
16
- description: "Check ERC20 token allowances for a spender address. Use before build_approve_tx to avoid redundant approvals — skip approving if the current allowance is already sufficient.",
16
+ description: "Check ERC20 token allowances for a spender address. Use before write.approve to avoid redundant approvals — skip approving if the current allowance is already sufficient.",
17
17
  inputSchema: {
18
18
  owner_address: z.string().describe("Token owner address (the wallet granting approval)"),
19
19
  spender_address: z
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export function registerAssetTools(server, api) {
3
- server.registerTool("get_assets", {
3
+ server.registerTool("read.assets", {
4
4
  annotations: {
5
5
  title: "Get Supported Assets",
6
6
  readOnlyHint: true,
@@ -4,7 +4,7 @@ import { erc20Abi } from "../../abis/index.js";
4
4
  import { getPublicClient } from "../../clients/chain.js";
5
5
  import { validateAddress, validateChainId } from "../../utils/validation.js";
6
6
  export function registerBalanceTools(server, chains) {
7
- server.registerTool("get_wallet_balances", {
7
+ server.registerTool("read.wallet_balances", {
8
8
  annotations: {
9
9
  title: "Get Wallet Balances",
10
10
  readOnlyHint: true,
@@ -12,7 +12,7 @@ export function registerBalanceTools(server, chains) {
12
12
  idempotentHint: true,
13
13
  openWorldHint: true,
14
14
  },
15
- description: "Get native ETH and ERC20 token balances for a wallet address. Reads directly from chain via RPC multicall. Use before build_add_liquidity_tx or build_deposit_tx to verify the wallet has sufficient tokens.",
15
+ description: "Get native ETH and ERC20 token balances for a wallet address. Reads directly from chain via RPC multicall. Use before advanced.add_liquidity or write.deposit to verify the wallet has sufficient tokens.",
16
16
  inputSchema: {
17
17
  wallet_address: z.string().describe("Wallet address to check balances for"),
18
18
  token_addresses: z.array(z.string()).describe("ERC20 token contract addresses to check"),
@@ -33,7 +33,7 @@ export function registerGuideTools(server) {
33
33
  guides.set(topic, `Guide "${topic}" is not available in this installation.`);
34
34
  }
35
35
  }
36
- server.registerTool("get_guide", {
36
+ server.registerTool("read.guide", {
37
37
  annotations: {
38
38
  title: "Get Guide",
39
39
  readOnlyHint: true,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export function registerPointsTools(server, api) {
3
- server.registerTool("get_points", {
3
+ server.registerTool("read.points", {
4
4
  annotations: {
5
5
  title: "Get Points",
6
6
  readOnlyHint: true,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export function registerPoolTools(server, api) {
3
- server.registerTool("get_lending_pools", {
3
+ server.registerTool("read.lending_pools", {
4
4
  annotations: {
5
5
  title: "Get Lending Pools",
6
6
  readOnlyHint: true,
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  export function registerProtocolTools(server, api) {
3
- server.registerTool("get_strategies", {
3
+ server.registerTool("read.strategies", {
4
4
  annotations: {
5
5
  title: "Get Strategies",
6
6
  readOnlyHint: true,
@@ -74,7 +74,7 @@ export function registerProtocolTools(server, api) {
74
74
  };
75
75
  }
76
76
  });
77
- server.registerTool("get_recommendation", {
77
+ server.registerTool("read.recommendation", {
78
78
  annotations: {
79
79
  title: "Get Recommendation",
80
80
  readOnlyHint: true,
@@ -82,7 +82,7 @@ export function registerProtocolTools(server, api) {
82
82
  idempotentHint: true,
83
83
  openWorldHint: true,
84
84
  },
85
- description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like get_strategies list view), so recommended strategies may differ from the list ranking.",
85
+ description: "Get a rebalancing recommendation for an Arcadia account — suggests asset changes to optimize yield. Uses 1d APY (not 7d like read.strategies list view), so recommended strategies may differ from the list ranking.",
86
86
  inputSchema: {
87
87
  account_address: z.string().describe("Arcadia account address"),
88
88
  chain_id: z.number().default(8453).describe("Chain ID: 8453 (Base) or 130 (Unichain)"),
@@ -5,7 +5,7 @@ import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  const MAX_UINT256 = 2n ** 256n - 1n;
7
7
  export function registerApproveTool(server, _chains) {
8
- server.registerTool("build_approve_tx", {
8
+ server.registerTool("write.approve", {
9
9
  annotations: {
10
10
  title: "Build Approve Transaction",
11
11
  readOnlyHint: false,
@@ -13,7 +13,7 @@ export function registerApproveTool(server, _chains) {
13
13
  idempotentHint: true,
14
14
  openWorldHint: false,
15
15
  },
16
- description: "Build an unsigned approval transaction. For ERC20 tokens: generates approve(spender, amount). For ERC721/ERC1155 NFTs (e.g. LP positions): generates setApprovalForAll(operator, true). Required before build_deposit_tx or build_add_liquidity_tx (when depositing from wallet). Tip: call get_allowance first to check if approval already exists — skip this if the current allowance is sufficient.",
16
+ description: "Build an unsigned approval transaction. For ERC20 tokens: generates approve(spender, amount). For ERC721/ERC1155 NFTs (e.g. LP positions): generates setApprovalForAll(operator, true). Required before write.deposit or advanced.add_liquidity (when depositing from wallet). Tip: call read.allowance first to check if approval already exists — skip this if the current allowance is sufficient.",
17
17
  inputSchema: {
18
18
  token_address: z.string().describe("Token contract address to approve"),
19
19
  spender_address: z
@@ -4,7 +4,7 @@ import { poolAbi } from "../../abis/index.js";
4
4
  import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  export function registerBorrowTool(server, _chains, api) {
7
- server.registerTool("build_borrow_tx", {
7
+ server.registerTool("write.borrow", {
8
8
  annotations: {
9
9
  title: "Build Borrow Transaction",
10
10
  readOnlyHint: false,
@@ -12,7 +12,7 @@ export function registerBorrowTool(server, _chains, api) {
12
12
  idempotentHint: true,
13
13
  openWorldHint: false,
14
14
  },
15
- description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. Only works with margin accounts (created with a creditor/lending pool). Spot accounts (no creditor) cannot borrow — the tool will validate this and reject. Before borrowing, verify the account has positive free margin via get_account_info: collateral_value must exceed used_margin.",
15
+ description: "Build an unsigned transaction to borrow from an Arcadia lending pool against account collateral. Only works with margin accounts (created with a creditor/lending pool). Spot accounts (no creditor) cannot borrow — the tool will validate this and reject. Before borrowing, verify the account has positive free margin via read.account_info: collateral_value must exceed used_margin.",
16
16
  inputSchema: {
17
17
  pool_address: z
18
18
  .string()
@@ -35,7 +35,7 @@ export function registerBorrowTool(server, _chains, api) {
35
35
  content: [
36
36
  {
37
37
  type: "text",
38
- text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using build_create_account_tx.",
38
+ text: "Error: This account has no creditor (spot account) and cannot borrow. Create a margin account with a creditor (lending pool) using write.create_account.",
39
39
  },
40
40
  ],
41
41
  isError: true,
@@ -116,7 +116,7 @@ function resolveAmAddress(chainId, amType, protocol) {
116
116
  return getAmProtocolAddress(chainId, AM_TYPE_TO_CATEGORY[amType], PROTOCOL_TO_AM_KEY[protocol]);
117
117
  }
118
118
  export function registerConfigureAssetManagerTool(server, _chains) {
119
- server.registerTool("build_configure_asset_manager_tx", {
119
+ server.registerTool("write.configure_asset_manager", {
120
120
  annotations: {
121
121
  title: "Build Configure Asset Manager Transaction",
122
122
  readOnlyHint: false,
@@ -124,7 +124,7 @@ export function registerConfigureAssetManagerTool(server, _chains) {
124
124
  idempotentHint: true,
125
125
  openWorldHint: false,
126
126
  },
127
- description: "Build an unsigned transaction to enable AND configure an asset manager on an Arcadia V3/V4 account. Unlike build_set_asset_manager_tx (which only grants permission), this also sets the initiator, fee limits, and strategy parameters in one transaction via setAssetManagers. Supports rebalancer (with trigger ratios and compound mode), compounder, yield claimer (with fee recipient), and merkl operator (with reward recipient). For cow_swapper, use build_set_asset_manager_tx instead (no callback data needed). Pass pool_protocol to auto-resolve the correct AM address (required for rebalancer/compounder/yield_claimer), or pass asset_manager_address directly. merkl_operator is protocol-agnostic and auto-resolves without pool_protocol. Returns { transaction: { to, data, value, chainId } }.",
127
+ description: "Build an unsigned transaction to enable AND configure an asset manager on an Arcadia V3/V4 account. Unlike write.set_asset_manager (which only grants permission), this also sets the initiator, fee limits, and strategy parameters in one transaction via setAssetManagers. Supports rebalancer (with trigger ratios and compound mode), compounder, yield claimer (with fee recipient), and merkl operator (with reward recipient). For cow_swapper, use write.set_asset_manager instead (no callback data needed). Pass pool_protocol to auto-resolve the correct AM address (required for rebalancer/compounder/yield_claimer), or pass asset_manager_address directly. merkl_operator is protocol-agnostic and auto-resolves without pool_protocol. Returns { transaction: { to, data, value, chainId } }.",
128
128
  inputSchema: {
129
129
  account_address: z.string().describe("Arcadia account address (must be V3 or V4)"),
130
130
  asset_manager_address: z
@@ -25,7 +25,7 @@ export function computeAccountAddress(factoryAddress, userSalt, walletAddress, i
25
25
  return getAddress(slice(raw, 12));
26
26
  }
27
27
  export function registerCreateAccountTool(server, chains) {
28
- server.registerTool("build_create_account_tx", {
28
+ server.registerTool("write.create_account", {
29
29
  annotations: {
30
30
  title: "Build Create Account Transaction",
31
31
  readOnlyHint: false,
@@ -102,7 +102,7 @@ export function registerCreateAccountTool(server, chains) {
102
102
  ...(predictedAddress && { predicted_account_address: predictedAddress }),
103
103
  next_steps: predictedAddress
104
104
  ? "The new account will be at predicted_account_address after tx confirms. You can use it immediately without waiting for indexing."
105
- : "After tx confirms, call get_account_info with wallet_address to find the new account. Note: there may be a short indexing delay.",
105
+ : "After tx confirms, call read.account_info with wallet_address to find the new account. Note: there may be a short indexing delay.",
106
106
  }, null, 2),
107
107
  },
108
108
  ],
@@ -5,7 +5,7 @@ import { getPublicClient } from "../../clients/chain.js";
5
5
  import { appendDataSuffix } from "../../utils/attribution.js";
6
6
  import { validateAddress, validateChainId } from "../../utils/validation.js";
7
7
  export function registerDepositTool(server, chains) {
8
- server.registerTool("build_deposit_tx", {
8
+ server.registerTool("write.deposit", {
9
9
  annotations: {
10
10
  title: "Build Deposit Transaction",
11
11
  readOnlyHint: false,
@@ -13,7 +13,7 @@ export function registerDepositTool(server, chains) {
13
13
  idempotentHint: true,
14
14
  openWorldHint: false,
15
15
  },
16
- description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before build_add_liquidity_tx — that tool deposits from wallet atomically. Ensure the account is approved first (call get_allowance to check, then build_approve_tx if needed). Account version is auto-detected on-chain (override with account_version if needed).",
16
+ description: "Build an unsigned transaction to deposit assets into an Arcadia account as collateral. Supports ERC20 tokens and ERC721 NFTs (LP positions). NOT needed before advanced.add_liquidity — that tool deposits from wallet atomically. Ensure the account is approved first (call read.allowance to check, then write.approve if needed). Account version is auto-detected on-chain (override with account_version if needed).",
17
17
  inputSchema: {
18
18
  account_address: z.string().describe("Arcadia account address"),
19
19
  asset_addresses: z.array(z.string()).describe("Token contract addresses to deposit"),
@@ -4,7 +4,7 @@ import { poolAbi } from "../../abis/index.js";
4
4
  import { appendDataSuffix } from "../../utils/attribution.js";
5
5
  import { validateAddress } from "../../utils/validation.js";
6
6
  export function registerRepayTool(server, _chains) {
7
- server.registerTool("build_repay_tx", {
7
+ server.registerTool("write.repay", {
8
8
  annotations: {
9
9
  title: "Build Repay Transaction",
10
10
  readOnlyHint: false,
@@ -12,7 +12,7 @@ export function registerRepayTool(server, _chains) {
12
12
  idempotentHint: true,
13
13
  openWorldHint: false,
14
14
  },
15
- description: "Build an unsigned transaction to repay debt to an Arcadia lending pool from your wallet. This tool does not validate whether the account has outstanding debt — check with get_account_info first. Check allowance first (get_allowance), then approve the pool if needed (build_approve_tx). To repay using account collateral instead, use build_repay_with_collateral_tx.",
15
+ description: "Build an unsigned transaction to repay debt to an Arcadia lending pool from your wallet. This tool does not validate whether the account has outstanding debt — check with read.account_info first. Check allowance first (read.allowance), then approve the pool if needed (write.approve). To repay using account collateral instead, use advanced.repay_with_collateral.",
16
16
  inputSchema: {
17
17
  pool_address: z
18
18
  .string()