Skip to main content
Glama
IQAIcom

Upbit MCP Server

by IQAIcom

CREATE_ORDER

Place a buy or sell order on the Upbit exchange. Specify market, side, order type, and optional parameters for advanced trading.

Instructions

Create an Upbit order (requires private API)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
marketYes
sideYes
ord_typeYes
volumeNo
priceNo
time_in_forceNo
smp_typeNo
identifierNo

Implementation Reference

  • The full tool definition including the 'execute' handler that creates an Upbit order by calling POST /orders with a signed JWT token. Returns the response as JSON.
    export const createOrderTool = {
    	name: "CREATE_ORDER",
    	description: "Create an Upbit order (requires private API)",
    	parameters: paramsSchema,
    	execute: async ({
    		market,
    		side,
    		ord_type,
    		volume,
    		price,
    		time_in_force,
    		smp_type,
    		identifier,
    	}: Params) => {
    		ensurePrivateEnabled();
    		const baseURL = `${config.upbit.baseUrl}${config.upbit.apiBasePath}`;
    		const client = createHttpClient(baseURL);
    		const body = {
    			market,
    			side,
    			ord_type,
    			volume,
    			price,
    			time_in_force,
    			smp_type,
    			identifier,
    		};
    		const token = signJwtToken(body);
    		const data = await fetchJson<unknown>(client, "/orders", {
    			method: "POST",
    			data: body,
    			headers: { Authorization: `Bearer ${token}` },
    		});
    		return JSON.stringify(data, null, 2);
    	},
    } as const;
  • Zod schema (paramsSchema) defining input validation for CREATE_ORDER: market, side (bid/ask), ord_type (limit/price/market), volume, price, time_in_force, smp_type, identifier with refine validations for limit/price/market order constraints.
    const paramsSchema = z
    	.object({
    		market: z.string(),
    		side: z.enum(["bid", "ask"]),
    		ord_type: z.enum(["limit", "price", "market"]),
    		volume: z.string().optional(),
    		price: z.string().optional(),
    		time_in_force: z.enum(["ioc", "fok", "post_only"]).optional(),
    		smp_type: z.enum(["cancel_maker", "cancel_taker", "reduce"]).optional(),
    		identifier: z.string().optional(),
    	})
    	.refine((p) => (p.ord_type === "limit" ? p.volume && p.price : true), {
    		message: "Limit orders require both volume and price",
    	})
    	.refine((p) => (p.ord_type === "price" ? !!p.price : true), {
    		message: "Market buy (price) requires price",
    	})
    	.refine((p) => (p.ord_type === "market" ? !!p.volume : true), {
    		message: "Market sell (market) requires volume",
    	})
    	.refine((p) => !(p.time_in_force === "post_only" && p.smp_type), {
    		message: "post_only cannot be used with smp_type",
    	});
  • src/index.ts:35-35 (registration)
    Registration of the order tool via server.addTool(createOrderTool) in the main index.ts file.
    server.addTool(createOrderTool);
  • signJwtToken helper that signs the order parameters into a JWT token using the Upbit secret key (query hash for SHA512). Used by the handler to authenticate the API call.
    export function signJwtToken(
    	params?: Record<string, string | number | boolean | undefined>,
    ): string {
    	const payload: Record<string, unknown> = {
    		access_key: config.upbit.accessKey,
    		nonce: crypto.randomUUID(),
    	};
    
    	if (params && Object.keys(params).length > 0) {
    		const searchParams = new URLSearchParams();
    		const sortedKeys = Object.keys(params).sort();
    		for (const key of sortedKeys) {
    			const value = params[key];
    			if (value === undefined) continue;
    			searchParams.append(key, String(value));
    		}
    		const encoded = searchParams.toString();
    		const queryHash = crypto.createHash("sha512").update(encoded).digest("hex");
    		payload.query_hash = queryHash;
    		payload.query_hash_alg = "SHA512";
    	}
    
    	return jwt.sign(payload, config.upbit.secretKey as string);
    }
  • fetchJson helper that performs the actual HTTP POST request to Upbit's /orders endpoint with retry logic.
    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?

The description discloses that the tool requires a private API, which is a behavioral note. However, it lacks details on side effects, error handling, rate limits, or whether the order creation is synchronous. For a mutation tool, this is insufficient.

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

Conciseness2/5

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

The description is very concise (one sentence), but at the expense of informativeness. It is under-specified and does not earn its place by providing crucial details.

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

Completeness1/5

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

Given the tool has 8 parameters, no output schema, and no annotations, the description is woefully incomplete. It fails to explain return values, required fields beyond the schema, or behavioral nuances.

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

Parameters1/5

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

The description does not mention any parameters, despite 8 parameters in the schema with 0% coverage. It adds no meaning beyond the tool name, leaving the agent to rely solely on the input schema, which is minimal.

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 (Create) and resource (Upbit order), distinguishing it from siblings like CANCEL_ORDER or CREATE_WITHDRAWAL. The mention of 'requires private API' adds context, making the purpose immediately understandable.

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 on when to use this tool versus alternatives (e.g., when to use limit vs market order). The only usage hint is that it requires a private API, but there is no mention of prerequisites or situational context.

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