GET_TICKER
Retrieve real-time ticker data for a specific cryptocurrency market on Upbit using the market code, such as KRW-BTC, enabling users to monitor current price and trading details.
Instructions
Get the latest ticker data from Upbit for a single market
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market | Yes | Upbit market code, e.g., KRW-BTC |
Implementation Reference
- src/tools/get-ticker.ts:16-24 (handler)The execute function that implements the core logic of the GET_TICKER tool: fetches ticker data from Upbit API using the provided market parameter and returns formatted JSON.execute: async ({ market }: Params) => { const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`; const client = createHttpClient(baseURL); const data = await fetchJson<unknown>(client, "/ticker", { params: { markets: market }, }); const item = Array.isArray(data) ? (data as any[])[0] : (data as any); return JSON.stringify(item, null, 2); },
- src/tools/get-ticker.ts:6-8 (schema)Zod schema defining the input parameters for the GET_TICKER tool (market string). This is referenced in the tool's parameters.const paramsSchema = z.object({ market: z.string().min(3).describe("Upbit market code, e.g., KRW-BTC"), });
- src/index.ts:31-31 (registration)Registers the getTickerTool (GET_TICKER) with the FastMCP server instance.server.addTool(getTickerTool);
- src/index.ts:15-15 (registration)Imports the getTickerTool for use in registration.import { getTickerTool } from "./tools/get-ticker.js";
- src/tools/get-ticker.ts:12-25 (handler)Full definition of the getTickerTool object, including name, description, parameters schema, and execute handler for the GET_TICKER tool.export const getTickerTool = { name: "GET_TICKER", description: "Get the latest ticker data from Upbit for a single market", parameters: paramsSchema, execute: async ({ market }: Params) => { const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`; const client = createHttpClient(baseURL); const data = await fetchJson<unknown>(client, "/ticker", { params: { markets: market }, }); const item = Array.isArray(data) ? (data as any[])[0] : (data as any); return JSON.stringify(item, null, 2); }, } as const;