fetchOrder
Retrieve detailed information about a specific cryptocurrency order using account credentials, order ID, and trading symbol with the CCXT MCP Server. Supports additional exchange-specific parameters for tailored queries.
Instructions
Fetch information about a specific order using a configured account
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| accountName | Yes | Account name defined in the configuration file (e.g., 'bybit_main') | |
| id | Yes | Order ID to fetch | |
| params | No | Additional exchange-specific parameters | |
| symbol | Yes | Trading symbol (e.g., 'BTC/USDT') |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"accountName": {
"description": "Account name defined in the configuration file (e.g., 'bybit_main')",
"type": "string"
},
"id": {
"description": "Order ID to fetch",
"type": "string"
},
"params": {
"additionalProperties": {},
"description": "Additional exchange-specific parameters",
"type": "object"
},
"symbol": {
"description": "Trading symbol (e.g., 'BTC/USDT')",
"type": "string"
}
},
"required": [
"accountName",
"id",
"symbol"
],
"type": "object"
}
Implementation Reference
- src/tools/order-tools.ts:167-209 (handler)Handler for the 'fetchOrder' tool: retrieves exchange instance, checks support for fetchOrder, calls exchange.fetchOrder(id, symbol, params), returns JSON or 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)Input schema using Zod for 'fetchOrder' tool parameters: accountName (string), id (string), symbol (string), params (optional record).{ 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)Registration of the 'fetchOrder' tool on the MCP server within registerOrderTools function, including name, description, input schema, and handler.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 in CcxtMcpServer's registerTools method, which registers the fetchOrder tool among others.registerOrderTools(this.server, this);