@arcadia-finance/mcp-server 0.5.2 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -42
- package/dist/clients/api.js +52 -5
- package/dist/clients/chain.js +1 -1
- package/dist/config/addresses.js +16 -3
- package/dist/index.js +36 -134
- package/dist/prompts/workflows.js +56 -18
- package/dist/resources/guides.js +1 -1
- package/dist/tools/aero.js +157 -0
- package/dist/tools/dev/send.js +4 -4
- package/dist/tools/index.js +6 -0
- package/dist/tools/output-schemas.js +105 -29
- package/dist/tools/read/account.js +13 -13
- package/dist/tools/read/aero-upgrade.js +53 -0
- package/dist/tools/read/asset-managers.js +9 -9
- package/dist/tools/read/assets.js +7 -7
- package/dist/tools/read/guides.js +4 -4
- package/dist/tools/read/points.js +4 -4
- package/dist/tools/read/pools.js +8 -8
- package/dist/tools/read/strategy.js +18 -14
- package/dist/tools/read/wallet.js +15 -15
- package/dist/tools/write/account/add-liquidity.js +131 -12
- package/dist/tools/write/account/aero-upgrade.js +124 -0
- package/dist/tools/write/account/borrow.js +5 -5
- package/dist/tools/write/account/close.js +8 -8
- package/dist/tools/write/account/create.js +3 -3
- package/dist/tools/write/account/deleverage.js +4 -4
- package/dist/tools/write/account/deposit.js +4 -4
- package/dist/tools/write/account/format-response.js +1 -1
- package/dist/tools/write/account/remove-liquidity.js +6 -6
- package/dist/tools/write/account/repay.js +4 -4
- package/dist/tools/write/account/stake.js +5 -5
- package/dist/tools/write/account/swap.js +4 -4
- package/dist/tools/write/account/withdraw.js +5 -5
- package/dist/tools/write/asset-managers/automations.js +14 -14
- package/dist/tools/write/asset-managers/intents.js +10 -7
- package/dist/tools/write/pool/deposit.js +5 -5
- package/dist/tools/write/pool/redeem.js +4 -4
- package/dist/tools/write/wallet/approve.js +4 -4
- package/dist/tools/write/wallet/upgrade-velo.js +76 -0
- package/dist/utils/analytics.js +68 -0
- package/dist/utils/http-config.js +4 -4
- package/llms-full.txt +83 -46
- package/llms.txt +47 -44
- package/package.json +8 -4
- package/server.json +4 -4
- package/skills/clamm-liquidity/SKILL.md +100 -82
- package/skills/clamm-liquidity/automation.md +14 -14
- package/skills/clamm-liquidity/selection.md +13 -13
- package/skills/clamm-liquidity/strategies.md +135 -53
- package/skills/openclaw/SKILL.md +3 -3
- package/skills/openclaw/arcadia.sh +24 -45
- package/skills/openclaw/contracts.md +11 -10
- package/dist/utils/tool-naming.js +0 -91
|
@@ -95,7 +95,7 @@ function trimOverview(overview, chainId) {
|
|
|
95
95
|
return trimmed;
|
|
96
96
|
}
|
|
97
97
|
export function registerAccountTools(server, api, chains) {
|
|
98
|
-
server.registerTool("
|
|
98
|
+
server.registerTool("read_account_info", {
|
|
99
99
|
annotations: {
|
|
100
100
|
title: "Get Account Info",
|
|
101
101
|
readOnlyHint: true,
|
|
@@ -104,13 +104,13 @@ export function registerAccountTools(server, api, chains) {
|
|
|
104
104
|
openWorldHint: true,
|
|
105
105
|
},
|
|
106
106
|
description: "Get full overview of an Arcadia account: health factor, collateral value, debt, deposited assets, liquidation price, and automation status. Health factor = 1 - (used_margin / liquidation_value): 1 = no debt (safest), >0 = healthy, 0 = liquidation threshold, <0 = past liquidation. Higher is safer. " +
|
|
107
|
-
"The `automation` object reports which asset managers are enabled (rebalancer, compounder, yield_claimer, cow_swapper, merkl_operator, gas_relayer), each as the position's dex_protocol when protocol-specific or true when account-level, plus `inferred_intents` (the automations those managers add up to), `merkl` claim state, and `deprecated_managers` for any superseded deployment still set on the account. Superseded managers should be cleared:
|
|
108
|
-
"LP positions in assets[] include a dex_protocol field (slipstream, slipstream_v2, slipstream_v3, staked_slipstream, staked_slipstream_v2, staked_slipstream_v3, uniV3, uniV4). To configure automations, prefer passing the position's id as position_id to
|
|
109
|
-
"Numeric fields without a _usd suffix are in the account's numeraire token raw units (divide by 10^decimals: 6 for USDC, 18 for WETH, 8 for cbBTC). Fields ending in _usd are in USD with 18 decimals (divide by 1e18). health_factor is unitless. Asset amounts are raw token units. To list all accounts for a wallet, use
|
|
110
|
-
inputSchema: {
|
|
107
|
+
"The `automation` object reports which asset managers are enabled (rebalancer, compounder, yield_claimer, cow_swapper, merkl_operator, gas_relayer), each as the position's dex_protocol when protocol-specific or true when account-level, plus `inferred_intents` (the automations those managers add up to), `merkl` claim state, and `deprecated_managers` for any superseded deployment still set on the account. Superseded managers should be cleared: write_account_automations disables them as part of a save. For the full decoded per-manager config use read_asset_manager_current. " +
|
|
108
|
+
"LP positions in assets[] include a dex_protocol field (slipstream, slipstream_v2, slipstream_v3, metadexcl_v1, staked_slipstream, staked_slipstream_v2, staked_slipstream_v3, staked_metadexcl_v1, uniV3, uniV4). metadexcl_v1 is Aero CL, live on Base, Optimism and Robinhood for spot and margin accounts. Slipstream V2 is Base-only. V3 is available on Base and Optimism. Unichain supports Slipstream V1, uniV3 and uniV4. To configure automations, prefer passing the position's id as position_id to write_account_automations, which resolves the protocol and tokens for you; the dex_protocol value is also accepted directly as its `protocol` param. " +
|
|
109
|
+
"Numeric fields without a _usd suffix are in the account's numeraire token raw units (divide by 10^decimals: 6 for USDC, 18 for WETH, 8 for cbBTC). Fields ending in _usd are in USD with 18 decimals (divide by 1e18). health_factor is unitless. Asset amounts are raw token units. To list all accounts for a wallet, use read_wallet_accounts.",
|
|
110
|
+
inputSchema: z.object({
|
|
111
111
|
account_address: z.string().describe("Arcadia account address"),
|
|
112
112
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
113
|
-
},
|
|
113
|
+
}),
|
|
114
114
|
outputSchema: AccountInfoOutput,
|
|
115
115
|
}, async ({ account_address, chain_id }) => {
|
|
116
116
|
try {
|
|
@@ -229,7 +229,7 @@ export function registerAccountTools(server, api, chains) {
|
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
231
|
if (!state.read_ok) {
|
|
232
|
-
notes.push("Automation state could not be confirmed on-chain, so the automation object may be incomplete. Retry, or read it directly with
|
|
232
|
+
notes.push("Automation state could not be confirmed on-chain, so the automation object may be incomplete. Retry, or read it directly with read_asset_manager_current.");
|
|
233
233
|
}
|
|
234
234
|
for (const w of state.warnings ?? [])
|
|
235
235
|
notes.push(`Automation state: ${w}`);
|
|
@@ -268,7 +268,7 @@ export function registerAccountTools(server, api, chains) {
|
|
|
268
268
|
};
|
|
269
269
|
}
|
|
270
270
|
});
|
|
271
|
-
server.registerTool("
|
|
271
|
+
server.registerTool("read_account_history", {
|
|
272
272
|
annotations: {
|
|
273
273
|
title: "Get Account History",
|
|
274
274
|
readOnlyHint: true,
|
|
@@ -277,11 +277,11 @@ export function registerAccountTools(server, api, chains) {
|
|
|
277
277
|
openWorldHint: true,
|
|
278
278
|
},
|
|
279
279
|
description: "Get an Arcadia account's historical net value over time. Returns a time series of snapshots, oldest first, each `{ timestamp, net_value }` — `timestamp` is unix seconds and `net_value` is USD (human-readable, not raw units). Useful for charting account performance over a period. An empty `history` means the account has no snapshots in the window, not that the read failed.",
|
|
280
|
-
inputSchema: {
|
|
280
|
+
inputSchema: z.object({
|
|
281
281
|
account_address: z.string().describe("Arcadia account address"),
|
|
282
282
|
days: z.number().default(14).describe("Number of days of history (default 14)"),
|
|
283
283
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
284
|
-
},
|
|
284
|
+
}),
|
|
285
285
|
outputSchema: AccountHistoryOutput,
|
|
286
286
|
}, async ({ account_address, days, chain_id }) => {
|
|
287
287
|
try {
|
|
@@ -311,7 +311,7 @@ export function registerAccountTools(server, api, chains) {
|
|
|
311
311
|
};
|
|
312
312
|
}
|
|
313
313
|
});
|
|
314
|
-
server.registerTool("
|
|
314
|
+
server.registerTool("read_account_pnl", {
|
|
315
315
|
annotations: {
|
|
316
316
|
title: "Get Account PnL",
|
|
317
317
|
readOnlyHint: true,
|
|
@@ -320,10 +320,10 @@ export function registerAccountTools(server, api, chains) {
|
|
|
320
320
|
openWorldHint: true,
|
|
321
321
|
},
|
|
322
322
|
description: "Get PnL (cost basis) and yield earned for an Arcadia account. Returns lifetime totals: cost basis vs current value (negative cost_basis = net profit withdrawn), net transfers per token, total yield earned in USD and per token. cost_basis, current_value, cost_diff are in USD (human-readable). Per-token fields (net_transfers, summed_yields_earned) are in raw token units.",
|
|
323
|
-
inputSchema: {
|
|
323
|
+
inputSchema: z.object({
|
|
324
324
|
account_address: z.string().describe("Arcadia account address"),
|
|
325
325
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
326
|
-
},
|
|
326
|
+
}),
|
|
327
327
|
outputSchema: AccountPnlOutput,
|
|
328
328
|
}, async ({ account_address, chain_id }) => {
|
|
329
329
|
try {
|
|
@@ -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
|
|
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("
|
|
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.
|
|
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("
|
|
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
|
|
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("
|
|
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
|
|
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("
|
|
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("
|
|
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("
|
|
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
|
|
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 {
|
package/dist/tools/read/pools.js
CHANGED
|
@@ -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("
|
|
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
|
|
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("
|
|
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
|
|
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("
|
|
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
|
|
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 {
|
|
@@ -62,10 +62,14 @@ export function registerStrategyTools(server, api) {
|
|
|
62
62
|
const all = await api.getStrategies(chain_id);
|
|
63
63
|
const list = Array.isArray(all) ? all : all.data;
|
|
64
64
|
if (Array.isArray(list)) {
|
|
65
|
-
|
|
65
|
+
const visible = list.filter((s) => {
|
|
66
|
+
const priceStatus = s.details?.price_status;
|
|
67
|
+
return priceStatus !== "off_market" && priceStatus !== "unpriced";
|
|
68
|
+
});
|
|
69
|
+
total = visible.length;
|
|
66
70
|
const effectiveOffset = offset ?? 0;
|
|
67
71
|
const effectiveLimit = limit ?? 25;
|
|
68
|
-
const page =
|
|
72
|
+
const page = visible.slice(effectiveOffset, effectiveOffset + effectiveLimit);
|
|
69
73
|
strategies = page.map((s) => ({
|
|
70
74
|
strategy_id: s.strategy_id,
|
|
71
75
|
name: s.strategy_name,
|
|
@@ -106,7 +110,7 @@ export function registerStrategyTools(server, api) {
|
|
|
106
110
|
};
|
|
107
111
|
}
|
|
108
112
|
});
|
|
109
|
-
server.registerTool("
|
|
113
|
+
server.registerTool("read_strategy_info", {
|
|
110
114
|
annotations: {
|
|
111
115
|
title: "Get Strategy Info",
|
|
112
116
|
readOnlyHint: true,
|
|
@@ -114,11 +118,11 @@ export function registerStrategyTools(server, api) {
|
|
|
114
118
|
idempotentHint: true,
|
|
115
119
|
openWorldHint: true,
|
|
116
120
|
},
|
|
117
|
-
description: "Get full detail for a specific LP strategy by ID
|
|
118
|
-
inputSchema: {
|
|
121
|
+
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%).",
|
|
122
|
+
inputSchema: z.object({
|
|
119
123
|
strategy_id: z.number().describe("Strategy ID"),
|
|
120
124
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
121
|
-
},
|
|
125
|
+
}),
|
|
122
126
|
outputSchema: StrategyDetailOutput,
|
|
123
127
|
}, async ({ strategy_id, chain_id }) => {
|
|
124
128
|
try {
|
|
@@ -140,7 +144,7 @@ export function registerStrategyTools(server, api) {
|
|
|
140
144
|
};
|
|
141
145
|
}
|
|
142
146
|
});
|
|
143
|
-
server.registerTool("
|
|
147
|
+
server.registerTool("read_strategy_recommendation", {
|
|
144
148
|
annotations: {
|
|
145
149
|
title: "Get Recommendation",
|
|
146
150
|
readOnlyHint: true,
|
|
@@ -148,11 +152,11 @@ export function registerStrategyTools(server, api) {
|
|
|
148
152
|
idempotentHint: true,
|
|
149
153
|
openWorldHint: true,
|
|
150
154
|
},
|
|
151
|
-
description: "Get a rebalancing recommendation for an Arcadia account
|
|
152
|
-
inputSchema: {
|
|
155
|
+
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.",
|
|
156
|
+
inputSchema: z.object({
|
|
153
157
|
account_address: z.string().describe("Arcadia account address"),
|
|
154
158
|
chain_id: z.number().default(8453).describe(CHAIN_ID_DESCRIPTION),
|
|
155
|
-
},
|
|
159
|
+
}),
|
|
156
160
|
outputSchema: StrategyRecommendationOutput,
|
|
157
161
|
}, async ({ account_address, chain_id }) => {
|
|
158
162
|
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("
|
|
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
|
|
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("
|
|
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
|
|
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("
|
|
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
|
|
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("
|
|
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 {
|