Skip to main content
Glama

get_orderbook

Retrieve current bid and ask price levels for cryptocurrency markets to analyze market depth and liquidity for trading decisions.

Instructions

Get the current orderbook (bid/ask levels) for a market.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYesMarket symbol, e.g. "BTC-KRW"
depthNoNumber of price levels (default 20)

Implementation Reference

  • The handler function for get_orderbook tool that executes the tool logic. It makes an API GET request to fetch orderbook data for a specific market symbol with configurable depth, then returns the data as JSON text content.
    async ({ symbol, depth }) => {
      const data = await apiGet<unknown>(`/markets/${symbol}/orderbook?depth=${depth}`);
      return {
        content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
      };
    }
  • Zod schema definition for get_orderbook tool inputs: 'symbol' (required string, e.g., 'BTC-KRW') and 'depth' (optional number with default value 20 for number of price levels).
    {
      symbol: z.string().describe('Market symbol, e.g. "BTC-KRW"'),
      depth: z.number().optional().default(20).describe("Number of price levels (default 20)"),
    },
  • src/index.ts:322-335 (registration)
    Complete registration of get_orderbook tool with the MCP server using server.tool(). Includes tool name, description, schema, and handler function.
    server.tool(
      "get_orderbook",
      "Get the current orderbook (bid/ask levels) for a market.",
      {
        symbol: z.string().describe('Market symbol, e.g. "BTC-KRW"'),
        depth: z.number().optional().default(20).describe("Number of price levels (default 20)"),
      },
      async ({ symbol, depth }) => {
        const data = await apiGet<unknown>(`/markets/${symbol}/orderbook?depth=${depth}`);
        return {
          content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
        };
      }
    );
  • The apiGet helper function used by get_orderbook handler to make authenticated HTTP GET requests to the API. Handles response validation and error handling.
    async function apiGet<T>(path: string): Promise<T> {
      const res = await fetch(`${API_BASE}${path}`, {
        headers: getAuthHeaders(),
      });
      if (!res.ok) {
        const text = await res.text();
        throw new Error(`API GET ${path} failed (${res.status}): ${text}`);
      }
      return res.json() as Promise<T>;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves data ('Get'), implying a read-only operation, but doesn't mention potential rate limits, latency, or whether it requires authentication (unlike siblings like 'place_order' that likely do). This leaves gaps in understanding the tool's operational context.

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 any wasted words. It directly addresses what the tool does, making it easy to parse and understand quickly.

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

Completeness3/5

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

For a read-only data retrieval tool with no output schema and no annotations, the description is minimally adequate. It covers the basic purpose but lacks details on return format (e.g., structure of bid/ask levels), error conditions, or integration with sibling tools. Given the complexity of financial data and the presence of related tools, more context would improve completeness.

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 input schema has 100% description coverage, clearly documenting both parameters ('symbol' and 'depth') with details like default values. The description adds no additional semantic meaning beyond what the schema provides, such as explaining how 'depth' affects performance or what 'bid/ask levels' entail. Baseline 3 is appropriate as the schema does the heavy lifting.

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 action ('Get') and resource ('current orderbook (bid/ask levels) for a market'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'get_ticker' or 'get_markets', which might also provide market data but in different formats.

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 like 'get_ticker' for price data or 'get_markets' for market listings. It lacks any context about prerequisites, such as needing an active market session or authentication, which could be relevant given sibling tools like 'activate' or 'register'.

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/mikusnuz/pexbot-mcp'

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