fetchOrder
Retrieve detailed information about a specific cryptocurrency trading order using account credentials, order ID, and trading symbol.
Instructions
Fetch information about a specific order using a configured account
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountName | Yes | Account name defined in the configuration file (e.g., 'bybit_main') | |
| id | Yes | Order ID to fetch | |
| symbol | Yes | Trading symbol (e.g., 'BTC/USDT') | |
| params | No | Additional exchange-specific parameters |
Implementation Reference
- src/tools/order-tools.ts:167-209 (handler)The handler function executes the fetchOrder tool by getting the CCXT exchange instance for the account, checking support for fetchOrder, calling exchange.fetchOrder(id, symbol, params), and returning the JSON stringified order or an error response.async ({ accountName, id, symbol, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchOrder 메서드가 지원되는지 확인 if (!exchange.has["fetchOrder"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching order details`, }, ], isError: true, }; } const order = await exchange.fetchOrder(id, symbol, params); return { content: [ { type: "text", text: JSON.stringify(order, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching order for account '${accountName}': ${ (error as Error).message }`, }, ], isError: true, }; } },
- src/tools/order-tools.ts:154-166 (schema)Zod input schema validating accountName (string), id (string), symbol (string), and optional params (record). Includes descriptions for each parameter.{ accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), id: z.string().describe("Order ID to fetch"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), },
- src/tools/order-tools.ts:151-210 (registration)The server.tool call that registers the fetchOrder tool with its name, description, input schema, and handler function.server.tool( "fetchOrder", "Fetch information about a specific order using a configured account", { accountName: z .string() .describe( "Account name defined in the configuration file (e.g., 'bybit_main')" ), id: z.string().describe("Order ID to fetch"), symbol: z.string().describe("Trading symbol (e.g., 'BTC/USDT')"), params: z .record(z.any()) .optional() .describe("Additional exchange-specific parameters"), }, async ({ accountName, id, symbol, params }) => { try { const exchange = ccxtServer.getExchangeInstance(accountName); // getExchangeInstance가 성공하면 인증은 보장됨 // fetchOrder 메서드가 지원되는지 확인 if (!exchange.has["fetchOrder"]) { return { content: [ { type: "text", text: `Account '${accountName}' (Exchange: ${exchange.id}) does not support fetching order details`, }, ], isError: true, }; } const order = await exchange.fetchOrder(id, symbol, params); return { content: [ { type: "text", text: JSON.stringify(order, null, 2), }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching order for account '${accountName}': ${ (error as Error).message }`, }, ], isError: true, }; } }, );
- src/server.ts:373-373 (registration)Top-level call to registerOrderTools function within CcxtMcpServer's registerTools method, which includes registration of the fetchOrder tool.registerOrderTools(this.server, this);