Skip to main content
Glama
kwonsw812

kiwoom-mcp

by kwonsw812

place_sell_order

Execute stock sell orders through Kiwoom Securities accounts. Supports market or limit orders for specified stock codes and quantities.

Instructions

주식 매도 주문을 실행합니다. 시장가 또는 지정가 매도를 지원합니다

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stock_codeYes종목코드 (예: 005930)
quantityYes주문 수량
priceNo주문 가격 (시장가일 경우 0)
order_typeNo주문유형: market(시장가) 또는 limit(지정가)market
account_noNo계좌번호 (미입력시 기본 계좌 사용)

Implementation Reference

  • The actual implementation of the placeSellOrder logic that interacts with the API client.
    async placeSellOrder(accountNo: string, stockCode: string, quantity: number, price: number, orderType: string) {
      const trde_tp = orderType === "market" ? "3" : "0";
      const body: Record<string, unknown> = {
        acc_no: accountNo,
        dmst_stex_tp: "KRX",
        stk_cd: stockCode,
        ord_qty: String(quantity),
        trde_tp,
      };
      if (orderType === "limit") {
        body.ord_uv = String(price);
      }
      return this.request("/api/dostk/ordr", "kt10001", body);
  • src/index.ts:697-723 (registration)
    Registration of the place_sell_order MCP tool and the handler function wrapping the client call.
    server.tool(
      "place_sell_order",
      "주식 매도 주문을 실행합니다. 시장가 또는 지정가 매도를 지원합니다",
      {
        stock_code: stockCodeSchema,
        quantity: z.number().int().positive().describe("주문 수량"),
        price: z.number().int().min(0).default(0).describe("주문 가격 (시장가일 경우 0)"),
        order_type: z.enum(["market", "limit"]).default("market").describe("주문유형: market(시장가) 또는 limit(지정가)"),
        account_no: accountNoSchema,
      },
      { readOnlyHint: false, idempotentHint: false },
      async ({ stock_code, quantity, price, order_type, account_no }) => {
        try {
          const acct = resolveAccountNo(account_no);
          if (order_type === "limit" && price <= 0) {
            return errorContent("지정가 주문 시 가격을 0보다 큰 값으로 입력해주세요.");
          }
          const data = await client.placeSellOrder(acct, stock_code, quantity, price, order_type);
          const orderNo = data.ord_no ?? "N/A";
          const typeLabel = order_type === "market" ? "시장가" : `지정가 ${formatCurrency(price)}`;
          let text = `## 매도 주문 완료\n\n`;
          text += `- 주문번호: ${orderNo}\n`;
          text += `- 종목코드: ${stock_code}\n`;
          text += `- 주문유형: ${typeLabel}\n`;
          text += `- 주문수량: ${quantity}주\n`;
          if (IS_MOCK) text += "\n(모의투자 주문)\n";
          return textContent(text);
Behavior3/5

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

Annotations indicate this is a non-readOnly, non-idempotent tool (mutation with side effects), which the description aligns with by implying execution of orders. The description adds minimal behavioral context beyond annotations—it mentions support for market/limit orders but doesn't cover critical aspects like confirmation mechanisms, error handling, or execution guarantees. No contradiction with annotations.

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 concise and front-loaded with the core action ('주식 매도 주문을 실행합니다'), followed by a brief feature note. It avoids redundancy and wastes no words, though it could be slightly more informative without losing efficiency.

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 mutation tool with no output schema and minimal annotations, the description is somewhat incomplete. It covers the basic action and order types but lacks details on return values, error cases, or dependencies (e.g., account authentication). Given the complexity of financial transactions, more context would be beneficial, but it meets a minimum viable threshold.

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 description coverage is 100%, with each parameter well-documented in the schema (e.g., stock_code pattern, price default for market orders). The description adds no additional parameter semantics beyond what the schema provides, such as explaining interactions between order_type and price. Baseline score of 3 is appropriate given high schema coverage.

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 tool's purpose as '주식 매도 주문을 실행합니다' (executes stock sell orders) and specifies it supports market or limit orders. It distinguishes from sibling tools like place_buy_order by focusing on selling, but doesn't explicitly differentiate from other order-related tools like cancel_order beyond the action type.

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 about when to use this tool versus alternatives. The description doesn't mention prerequisites (e.g., needing sufficient holdings), compare with market vs. limit order scenarios, or reference sibling tools like cancel_order for order management. Usage context is implied but not stated.

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/kwonsw812/kiwoom-mcp'

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