get_stock_chart
Retrieve daily OHLCV chart data for Korean stocks by stock code and date, displaying recent data first for analysis.
Instructions
기준일자 기준 일봉 OHLCV 차트 데이터를 조회합니다 (최근 데이터부터 내림차순)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stock_code | Yes | 종목코드 (예: 005930) | |
| base_date | No | 기준일자 (이 날짜 이전 데이터 조회) (YYYYMMDD 형식) |
Implementation Reference
- src/index.ts:187-193 (handler)The underlying method that performs the API request to fetch stock chart data.
async getStockChart(stockCode: string, baseDate: string) { return this.request("/api/dostk/chart", "ka10081", { stk_cd: stockCode, base_dt: baseDate, upd_stkpc_tp: "1", }); } - src/index.ts:578-595 (registration)The MCP tool definition and handler logic for "get_stock_chart".
// 5. get_stock_chart - 일봉 차트 (ka10081) server.tool( "get_stock_chart", "기준일자 기준 일봉 OHLCV 차트 데이터를 조회합니다 (최근 데이터부터 내림차순)", { stock_code: stockCodeSchema, base_date: dateSchema("기준일자 (이 날짜 이전 데이터 조회)").optional(), }, { readOnlyHint: true }, async ({ stock_code, base_date }) => { try { const data = await client.getStockChart(stock_code, base_date ?? today()); return textContent(formatChartData(data)); } catch (error) { return errorContent(formatError(error)); } } );