listAccounts
Retrieve all configured account names from the CCXT MCP Server, enabling AI models to access and manage cryptocurrency exchange connections efficiently.
Instructions
List all configured account names
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {},
"type": "object"
}
Implementation Reference
- src/tools/account-tools.ts:21-65 (handler)The handler function that implements the listAccounts tool logic. It calls ccxtServer.getAccountNames() to get the list, handles the empty list case with detailed troubleshooting instructions, and returns a formatted text response with the account list.async () => { console.error(`[DEBUG] listAccounts tool called`); const accountNames = ccxtServer.getAccountNames(); if (accountNames.length === 0) { console.error(`[WARN] No accounts found in listAccounts tool`); return { content: [ { type: "text", text: `No accounts were loaded from the configuration. Please check your config file at: ${ccxtServer['configPath']} Possible issues: 1. The config file doesn't exist 2. The config file doesn't have the correct format (should have an 'accounts' array) 3. API keys in the config file are invalid 4. Permission issues with accessing the config file Your config should look like: { "accounts": [ { "name": "account_name", "exchangeId": "exchange_id", "apiKey": "your_api_key", "secret": "your_secret_key", "defaultType": "spot" } ] }`, }, ], }; } console.error(`[DEBUG] Returning ${accountNames.length} accounts from listAccounts tool`); return { content: [ { type: "text", text: `Configured accounts (${accountNames.length}):\n${accountNames.join("\n")}`, }, ], }; }
- src/tools/account-tools.ts:17-66 (registration)Direct registration of the listAccounts tool using server.tool() call within registerAccountTools function, specifying name, description, empty input schema, and inline handler.server.tool( "listAccounts", "List all configured account names", {}, async () => { console.error(`[DEBUG] listAccounts tool called`); const accountNames = ccxtServer.getAccountNames(); if (accountNames.length === 0) { console.error(`[WARN] No accounts found in listAccounts tool`); return { content: [ { type: "text", text: `No accounts were loaded from the configuration. Please check your config file at: ${ccxtServer['configPath']} Possible issues: 1. The config file doesn't exist 2. The config file doesn't have the correct format (should have an 'accounts' array) 3. API keys in the config file are invalid 4. Permission issues with accessing the config file Your config should look like: { "accounts": [ { "name": "account_name", "exchangeId": "exchange_id", "apiKey": "your_api_key", "secret": "your_secret_key", "defaultType": "spot" } ] }`, }, ], }; } console.error(`[DEBUG] Returning ${accountNames.length} accounts from listAccounts tool`); return { content: [ { type: "text", text: `Configured accounts (${accountNames.length}):\n${accountNames.join("\n")}`, }, ], }; } );
- src/server.ts:371-376 (registration)Higher-level registration in CcxtMcpServer's registerTools() method, which calls registerAccountTools(server, this) to register all account-related tools including listAccounts.private registerTools() { registerMarketTools(this.server, this); registerOrderTools(this.server, this); registerAccountTools(this.server, this); registerAnalysisTools(this.server, this); }
- src/server.ts:315-319 (helper)Helper method getAccountNames() on CcxtMcpServer, used by the listAccounts handler to retrieve the names of all loaded account exchange instances.getAccountNames(): string[] { const accountNames = Object.keys(this.exchangeInstances); console.error(`[DEBUG] getAccountNames() called, returning ${accountNames.length} accounts: ${accountNames.join(', ')}`); return accountNames; }