search_stock
Retrieve stock basic information including name, market classification, industry, and listing date using a 6-digit stock code.
Instructions
종목코드로 종목명, 시장구분, 업종, 상장일 등 종목 기본 정보를 조회합니다
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"stock_code": "<stock_code>"
},
"name": "search_stock"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| stock_code | Yes | 종목코드 (예: 005930) |
Implementation Reference
- src/index.ts:603-619 (handler)Handler logic for the search_stock tool.
async ({ stock_code }) => { try { const data = await client.getStockInfo(stock_code); let text = `## 종목 정보\n\n`; text += `- 종목코드: ${data.code ?? stock_code}\n`; text += `- 종목명: ${data.name ?? "-"}\n`; text += `- 시장: ${data.marketName ?? "-"} (${data.marketCode ?? "-"})\n`; text += `- 업종: ${data.upName ?? "-"}\n`; text += `- 상장일: ${data.regDay ?? "-"}\n`; text += `- 전일종가: ${formatCurrency(data.lastPrice ?? "-")}\n`; text += `- 상장주식수: ${Number(data.listCount ?? 0).toLocaleString("ko-KR")}주\n`; text += `- 종목상태: ${data.state ?? "-"}\n`; return textContent(text); } catch (error) { return errorContent(formatError(error)); } } - src/index.ts:598-620 (registration)Registration of the search_stock tool.
server.tool( "search_stock", "종목코드로 종목명, 시장구분, 업종, 상장일 등 종목 기본 정보를 조회합니다", { stock_code: stockCodeSchema }, { readOnlyHint: true }, async ({ stock_code }) => { try { const data = await client.getStockInfo(stock_code); let text = `## 종목 정보\n\n`; text += `- 종목코드: ${data.code ?? stock_code}\n`; text += `- 종목명: ${data.name ?? "-"}\n`; text += `- 시장: ${data.marketName ?? "-"} (${data.marketCode ?? "-"})\n`; text += `- 업종: ${data.upName ?? "-"}\n`; text += `- 상장일: ${data.regDay ?? "-"}\n`; text += `- 전일종가: ${formatCurrency(data.lastPrice ?? "-")}\n`; text += `- 상장주식수: ${Number(data.listCount ?? 0).toLocaleString("ko-KR")}주\n`; text += `- 종목상태: ${data.state ?? "-"}\n`; return textContent(text); } catch (error) { return errorContent(formatError(error)); } } );