Skip to main content
Glama

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
NameRequiredDescriptionDefault
accountNameYesAccount name defined in the configuration file (e.g., 'bybit_main')
idYesOrder ID to fetch
symbolYesTrading symbol (e.g., 'BTC/USDT')
paramsNoAdditional exchange-specific parameters

Implementation Reference

  • 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,
        };
      }
    },
  • 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"),
    },
  • 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);
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool fetches information, implying a read-only operation, but doesn't clarify if it requires authentication, has rate limits, returns specific data formats, or handles errors. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior and constraints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose without unnecessary details. Every word contributes to understanding the tool's function, making it appropriately sized and well-structured for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (4 parameters, no output schema, no annotations), the description is incomplete. It lacks details on behavioral traits, usage context, and output expectations, which are crucial for an AI agent to invoke it correctly. The high schema coverage helps with parameters, but overall, the description doesn't compensate for missing annotations and output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds no parameter-specific information beyond what's already in the schema, which has 100% coverage. It mentions 'using a configured account', which loosely relates to the 'accountName' parameter, but doesn't explain parameter interactions or provide examples. With high schema coverage, the baseline is 3, as the schema adequately documents parameters without extra description input.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Fetch information about a specific order using a configured account'. It specifies the verb ('fetch'), resource ('order'), and context ('using a configured account'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'fetchOpenOrders' or 'fetchClosedOrders', which are similar fetch operations for different order types.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'fetchOpenOrders' or 'fetchClosedOrders', nor does it specify prerequisites such as needing a configured account or valid order ID. The phrase 'using a configured account' is the only contextual hint, but it's insufficient for distinguishing between similar fetch operations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lazy-dinosaur/ccxt-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server