Skip to main content
Glama
migusdn

KIS REST API MCP Server

inquery-stock-ask

Retrieve the ask price for Korean stocks using the KIS REST API MCP Server to check current selling prices for informed trading decisions.

Instructions

Get stock ask price from Korea Investment & Securities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes

Implementation Reference

  • The main execution logic for the 'inquery-stock-ask' tool, which queries the Korea Investment & Securities API for stock ask prices using the provided symbol.
    async def inquery_stock_ask(symbol: str): """ Get stock ask price from Korea Investment & Securities Args: symbol: Stock symbol (e.g. "005930") Returns: Dictionary containing stock ask price information """ async with httpx.AsyncClient() as client: token = await get_access_token(client) # Prepare request data request_data = { "FID_COND_MRKT_DIV_CODE": "J", # 시장구분 "FID_INPUT_ISCD": symbol, # 종목코드 } response = await client.get( f"{TrIdManager.get_domain('stock_ask')}{STOCK_ASK_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("stock_ask") }, params=request_data ) if response.status_code != 200: raise Exception(f"Failed to get stock ask: {response.text}") return response.json()
  • server.py:605-608 (registration)
    Registers the 'inquery-stock-ask' tool with the MCP server using the @mcp.tool decorator.
    @mcp.tool( name="inquery-stock-ask", description="Get stock ask price from Korea Investment & Securities", )
  • Docstring providing input schema (symbol: str) and output description for the tool.
    """ Get stock ask price from Korea Investment & Securities Args: symbol: Stock symbol (e.g. "005930") Returns: Dictionary containing stock ask price information """
  • API endpoint path constant used by the stock ask tool.
    STOCK_ASK_PATH = "/uapi/domestic-stock/v1/quotations/inquire-asking-price-exp-ccn" # 주식호가조회
  • Transaction ID (TR_ID) for stock ask price inquiry in real account, defined in TrIdManager.
    "stock_ask": "FHKST01010200", # 주식호가조회

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/migusdn/KIS_MCP_Server'

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