Skip to main content
Glama
IQAIcom

Upbit MCP Server

by IQAIcom

GET_ORDERBOOK

Retrieve the current orderbook snapshot for a specific Upbit market. Enter the market code to get bid and ask depth data.

Instructions

Get orderbook snapshot for a given market

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
marketYesUpbit market code, e.g., KRW-BTC

Implementation Reference

  • The execute function that calls Upbit API /orderbook with the market parameter and returns the first orderbook entry as formatted JSON.
    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);
    },
  • Zod schema defining the input parameter: a market string (min 3 characters).
    const paramsSchema = z.object({
    	market: z.string().min(3).describe("Upbit market code, e.g., KRW-BTC"),
    });
  • src/index.ts:32-32 (registration)
    Registration of the GET_ORDERBOOK tool on the FastMCP server.
    server.addTool(getOrderbookTool);
  • Tool definition object with name 'GET_ORDERBOOK', description, parameters schema, and execute handler.
    export const getOrderbookTool = {
    	name: "GET_ORDERBOOK",
    	description: "Get orderbook snapshot for a given 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, "/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);
    	},
    } as const;
  • Generic HTTP helper used by the handler to fetch JSON data from the Upbit API.
    export async function fetchJson<T>(
    	client: AxiosInstance,
    	url: string,
    	options: {
    		method?: "GET" | "POST" | "DELETE" | "PUT" | "PATCH";
    		params?: Record<string, unknown>;
    		data?: unknown;
    		headers?: Record<string, string>;
    	} = {},
    	schema?: z.ZodType<T>,
    ): Promise<T> {
    	try {
    		const response = await client.request({
    			url,
    			method: options.method ?? "GET",
    			params: options.params,
    			data: options.data,
    			headers: options.headers,
    		});
    
    		const data = response.data;
    		if (schema) {
    			return schema.parse(data);
    		}
    		return data as T;
    	} catch (err) {
    		if (axios.isAxiosError(err)) {
    			const ae = err as AxiosError;
    			const status = ae.response?.status ?? 0;
    			const message = ae.message || "HTTP request failed";
    			const data = ae.response?.data;
    			throw new HttpError(status, message, data);
    		}
    		throw err;
    	}
    }
Behavior2/5

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

With no annotations, the description carries full burden. It fails to explain what 'snapshot' entails (e.g., depth, aggregation, top levels). No mention of data freshness, rate limits, or whether it's a full or partial orderbook.

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

Conciseness4/5

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

The description is a single sentence with no extraneous words. It is appropriately sized but could benefit from slightly more context without losing conciseness.

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 no output schema, the description should explain what the response contains (e.g., bids, asks, depth level). It is incomplete as a market data tool, lacking details on format or content.

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?

Schema coverage is 100% with the parameter description already containing an example. The tool description adds no additional meaning beyond what the schema provides, meeting the baseline.

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

Purpose5/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 ('orderbook snapshot') with the required parameter ('market'). It distinguishes from siblings like GET_ORDER, GET_ORDERS, and GET_TRADES which serve different purposes.

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?

No guidance is provided on when to use this tool vs alternatives. The description does not mention context such as real-time vs historical, or comparison to GET_TRADES or GET_TICKER.

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/IQAIcom/mcp-upbit'

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