krx-cli 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +1 -1
- package/dist/cli.js +27 -4
- package/dist/cli.js.map +3 -3
- package/dist/mcp.js +20 -3
- package/dist/mcp.js.map +3 -3
- package/package.json +1 -1
package/dist/mcp.js
CHANGED
|
@@ -31202,6 +31202,17 @@ function errorResult(message) {
|
|
|
31202
31202
|
};
|
|
31203
31203
|
}
|
|
31204
31204
|
|
|
31205
|
+
// src/utils/isin.ts
|
|
31206
|
+
var KRX_ISIN_RE = /^KR\d{10}$/;
|
|
31207
|
+
function matchesIsuCode(isuCd, srtCd, query) {
|
|
31208
|
+
if (isuCd === query || srtCd === query) return true;
|
|
31209
|
+
if (KRX_ISIN_RE.test(query)) {
|
|
31210
|
+
const short = query.slice(3, 9);
|
|
31211
|
+
return isuCd === short || srtCd === short;
|
|
31212
|
+
}
|
|
31213
|
+
return false;
|
|
31214
|
+
}
|
|
31215
|
+
|
|
31205
31216
|
// src/mcp/tools/index.ts
|
|
31206
31217
|
function getEndpointShortName(path5) {
|
|
31207
31218
|
return path5.split("/").pop() ?? path5;
|
|
@@ -31238,7 +31249,9 @@ function buildInputSchema(endpoints) {
|
|
|
31238
31249
|
date_to: external_exports.string().optional().describe(
|
|
31239
31250
|
"End date for range query (YYYYMMDD). Use with date_from for multi-day data."
|
|
31240
31251
|
),
|
|
31241
|
-
isuCd: external_exports.string().optional().describe(
|
|
31252
|
+
isuCd: external_exports.string().optional().describe(
|
|
31253
|
+
"Stock/item code to filter. Accepts both ISIN (e.g., KR7005930003) and short code (e.g., 005930)."
|
|
31254
|
+
),
|
|
31242
31255
|
sort: external_exports.string().optional().describe("Sort results by this field name"),
|
|
31243
31256
|
sort_direction: external_exports.enum(["asc", "desc"]).optional().describe("Sort direction (default: desc)"),
|
|
31244
31257
|
offset: external_exports.number().optional().describe("Skip first N results (use with limit for pagination)"),
|
|
@@ -31313,7 +31326,9 @@ function createCategoryTool(categoryId) {
|
|
|
31313
31326
|
}
|
|
31314
31327
|
let data2 = rangeResult.data;
|
|
31315
31328
|
if (isuCd) {
|
|
31316
|
-
data2 = data2.filter(
|
|
31329
|
+
data2 = data2.filter(
|
|
31330
|
+
(row) => matchesIsuCode(row["ISU_CD"] ?? "", row["ISU_SRT_CD"] ?? "", isuCd)
|
|
31331
|
+
);
|
|
31317
31332
|
}
|
|
31318
31333
|
const filterExpr = args.filter;
|
|
31319
31334
|
const sortField2 = args.sort;
|
|
@@ -31357,7 +31372,9 @@ function createCategoryTool(categoryId) {
|
|
|
31357
31372
|
const limitN = args.limit;
|
|
31358
31373
|
let data = result.data;
|
|
31359
31374
|
if (isuCd) {
|
|
31360
|
-
data = data.filter(
|
|
31375
|
+
data = data.filter(
|
|
31376
|
+
(row) => matchesIsuCode(row["ISU_CD"] ?? "", row["ISU_SRT_CD"] ?? "", isuCd)
|
|
31377
|
+
);
|
|
31361
31378
|
}
|
|
31362
31379
|
data = applyPipeline(data, {
|
|
31363
31380
|
filter: filterExpr2,
|