GET_ORDERBOOK
Retrieve an orderbook snapshot for a specified cryptocurrency market on Upbit. Input the market code to access real-time bid and ask data for trading analysis and decision-making.
Instructions
Get orderbook snapshot for a given market
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | Upbit market code, e.g., KRW-BTC |
Implementation Reference
- src/tools/get-orderbook.ts:15-24 (handler)The execute function implementing the core logic of the GET_ORDERBOOK tool, which fetches the orderbook snapshot from the Upbit API for the given market.execute: async ({ market }: Params) => { const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`; const client = createHttpClient(baseURL); const data = await fetchJson<unknown>(client, "/orderbook", { params: { markets: market }, }); /** biome-ignore lint/suspicious/noExplicitAny: <not important> */ const item = Array.isArray(data) ? (data as any[])[0] : (data as any); return JSON.stringify(item, null, 2); },
- src/tools/get-orderbook.ts:5-7 (schema)Zod schema defining the input parameters for the GET_ORDERBOOK tool (market string).const paramsSchema = z.object({ market: z.string().min(3).describe("Upbit market code, e.g., KRW-BTC"), });
- src/index.ts:32-32 (registration)Registers the getOrderbookTool with the FastMCP server instance.server.addTool(getOrderbookTool);