inquery-order-detail
Retrieve detailed order information from Korea Investment & Securities by providing order number and date for accurate tracking and management.
Instructions
Get order detail from Korea Investment & Securities
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| order_date | Yes | ||
| order_no | Yes |
Implementation Reference
- server.py:460-463 (registration)Registers the 'inquery-order-detail' tool using the @mcp.tool decorator, specifying name and description.@mcp.tool( name="inquery-order-detail", description="Get order detail from Korea Investment & Securities", )
- server.py:464-511 (handler)The handler function that implements the tool logic: authenticates with KIS API, prepares request parameters using order_no and order_date, sends GET request to order detail endpoint, and returns the JSON response.async def inquery_order_detail(order_no: str, order_date: str): """ Get order detail from Korea Investment & Securities Args: order_no: Order number order_date: Order date (YYYYMMDD) Returns: Dictionary containing order detail information """ async with httpx.AsyncClient() as client: token = await get_access_token(client) # Prepare request data request_data = { "CANO": os.environ["KIS_CANO"], # 계좌번호 "ACNT_PRDT_CD": "01", # 계좌상품코드 "INQR_DVSN": "00", # 조회구분 "PDNO": "", # 종목코드 "ORD_STRT_DT": order_date, # 주문시작일자 "ORD_END_DT": order_date, # 주문종료일자 "SLL_BUY_DVSN_CD": "00", # 매도매수구분 "CCLD_DVSN": "00", # 체결구분 "ORD_GNO_BRNO": "", # 주문채번지점번호 "ODNO": order_no, # 주문번호 "INQR_DVSN_3": "00", # 조회구분3 "INQR_DVSN_1": "", # 조회구분1 "CTX_AREA_FK100": "", # 연속조회검색조건100 "CTX_AREA_NK100": "", # 연속조회키100 } response = await client.get( f"{TrIdManager.get_domain('order_detail')}{ORDER_DETAIL_PATH}", headers={ "content-type": CONTENT_TYPE, "authorization": f"{AUTH_TYPE} {token}", "appkey": os.environ["KIS_APP_KEY"], "appsecret": os.environ["KIS_APP_SECRET"], "tr_id": TrIdManager.get_tr_id("order_detail") }, params=request_data ) if response.status_code != 200: raise Exception(f"Failed to get order detail: {response.text}") return response.json()