@apocdata-info/mcp-server 0.1.0
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/CHANGELOG.md +50 -0
- package/LICENSE +191 -0
- package/README.md +230 -0
- package/dist/cache.d.ts +26 -0
- package/dist/cache.js +51 -0
- package/dist/cache.js.map +1 -0
- package/dist/client.js +113 -0
- package/dist/errors.d.ts +37 -0
- package/dist/errors.js +56 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/resources.js +229 -0
- package/dist/server.d.ts +20 -0
- package/dist/server.js +69 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/factor-registry.d.ts +17 -0
- package/dist/tools/factor-registry.js +36 -0
- package/dist/tools/factor-registry.js.map +1 -0
- package/dist/tools/index.d.ts +21 -0
- package/dist/tools/index.js +45 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/macro-dashboard.d.ts +17 -0
- package/dist/tools/macro-dashboard.js +30 -0
- package/dist/tools/macro-dashboard.js.map +1 -0
- package/dist/tools/macro-indicator.d.ts +17 -0
- package/dist/tools/macro-indicator.js +45 -0
- package/dist/tools/macro-indicator.js.map +1 -0
- package/dist/tools/quotes-snapshot.d.ts +17 -0
- package/dist/tools/quotes-snapshot.js +39 -0
- package/dist/tools/quotes-snapshot.js.map +1 -0
- package/dist/tools/stock-bars-daily.d.ts +17 -0
- package/dist/tools/stock-bars-daily.js +45 -0
- package/dist/tools/stock-bars-daily.js.map +1 -0
- package/dist/tools/stock-detail.d.ts +17 -0
- package/dist/tools/stock-detail.js +38 -0
- package/dist/tools/stock-detail.js.map +1 -0
- package/dist/tools/stock-financials.d.ts +17 -0
- package/dist/tools/stock-financials.js +36 -0
- package/dist/tools/stock-financials.js.map +1 -0
- package/dist/tools/stock-list.d.ts +17 -0
- package/dist/tools/stock-list.js +39 -0
- package/dist/tools/stock-list.js.map +1 -0
- package/dist/tools/stock-news.d.ts +17 -0
- package/dist/tools/stock-news.js +36 -0
- package/dist/tools/stock-news.js.map +1 -0
- package/dist/tools/stock-quote.d.ts +17 -0
- package/dist/tools/stock-quote.js +32 -0
- package/dist/tools/stock-quote.js.map +1 -0
- package/dist/tools/top10-holders.d.ts +17 -0
- package/dist/tools/top10-holders.js +35 -0
- package/dist/tools/top10-holders.js.map +1 -0
- package/dist/tools/trade-days.d.ts +17 -0
- package/dist/tools/trade-days.js +36 -0
- package/dist/tools/trade-days.js.map +1 -0
- package/dist/tools/types.d.ts +29 -0
- package/dist/tools/types.js +16 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools.js +540 -0
- package/dist/transport.d.ts +44 -0
- package/dist/transport.js +87 -0
- package/dist/transport.js.map +1 -0
- package/dist/types.d.ts +54 -0
- package/dist/types.js +16 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
- package/scripts/client-unit-test.mjs +147 -0
- package/scripts/contract-test.mjs +167 -0
- package/scripts/coverage-test.mjs +126 -0
- package/scripts/error-path-test.mjs +110 -0
- package/scripts/freshness-probe.mjs +144 -0
- package/scripts/integration-test.mjs +284 -0
- package/scripts/mcp-e2e-test.mjs +196 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-list.js","sourceRoot":"","sources":["../../src/tools/stock-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,SAAS,GAAY;IAChC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,2HAA2H;IACxI,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,OAAO,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC,EAAE;YAClE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,OAAO,EAAE,GAAG,EAAE;SAC3E;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,OAAO,GAAI,IAAI,CAAC,OAAkB,IAAI,CAAC,CAAC;QAC9C,MAAM,IAAI,GAAI,IAAI,CAAC,IAAe,IAAI,GAAG,CAAC;QAC1C,MAAM,QAAQ,GAAG,uBAAuB,OAAO,IAAI,IAAI,EAAE,CAAC;QAC1D,OAAO,SAAS,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE;YACpD,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;YACvE,IAAI,CAAC,CAAC,KAAK;gBAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;YAChD,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import type { ToolDef } from "./types.js";
|
|
17
|
+
export declare const stockNews: ToolDef;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import { callDataPlane } from "../transport.js";
|
|
17
|
+
export const stockNews = {
|
|
18
|
+
name: "get_stock_news",
|
|
19
|
+
description: "获取单只 A 股最近新闻(标题/来源/发布时间/摘要),按发布时间倒序。默认返 20 条。本端点**不缓存**(新闻时效性强)。",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
symbol: { type: "string", description: "6 位 A 股代码" },
|
|
24
|
+
limit: { type: "integer", description: "返回条数,默认 20,最大 50", default: 20 },
|
|
25
|
+
},
|
|
26
|
+
required: ["symbol"],
|
|
27
|
+
},
|
|
28
|
+
handler: async (args, client) => {
|
|
29
|
+
const symbol = args.symbol;
|
|
30
|
+
const limit = args.limit ?? 20;
|
|
31
|
+
const r = await callDataPlane(client, `/v1/stocks/${encodeURIComponent(symbol)}/news`, { limit });
|
|
32
|
+
if (r.error)
|
|
33
|
+
return { error: true, ...r.error };
|
|
34
|
+
return { data: r.data, meta: r.meta };
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-news.js","sourceRoot":"","sources":["../../src/tools/stock-news.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,CAAC,MAAM,SAAS,GAAY;IAChC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,kEAAkE;IAC/E,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE;YACpD,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,EAAE;SACzE;QACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;QACrC,MAAM,KAAK,GAAI,IAAI,CAAC,KAAgB,IAAI,EAAE,CAAC;QAC3C,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,cAAc,kBAAkB,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAClG,IAAI,CAAC,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import type { ToolDef } from "./types.js";
|
|
17
|
+
export declare const stockQuote: ToolDef;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import { callDataPlane } from "../transport.js";
|
|
17
|
+
export const stockQuote = {
|
|
18
|
+
name: "get_stock_quote",
|
|
19
|
+
description: "获取单只 A 股最新实时行情快照(含 last_price, change_pct, volume, turnover, bid/ask)。延迟 15 分钟(SKU-FREE)/ 0 分钟(SKU-PRO+)。返回值含 meta.ingestLagSeconds 表示数据新鲜度。本端点**不缓存**(实时性优先)。",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: { symbol: { type: "string", description: "6 位 A 股代码,如 '000001'" } },
|
|
23
|
+
required: ["symbol"],
|
|
24
|
+
},
|
|
25
|
+
handler: async (args, client) => {
|
|
26
|
+
const symbol = args.symbol;
|
|
27
|
+
const r = await callDataPlane(client, `/v1/stocks/${encodeURIComponent(symbol)}/quote`);
|
|
28
|
+
if (r.error)
|
|
29
|
+
return { error: true, ...r.error };
|
|
30
|
+
return { data: r.data, meta: r.meta };
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stock-quote.js","sourceRoot":"","sources":["../../src/tools/stock-quote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,CAAC,MAAM,UAAU,GAAY;IACjC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,gKAAgK;IAC7K,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sBAAsB,EAAE,EAAE;QAC/E,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;QACrC,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,cAAc,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACxF,IAAI,CAAC,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;QAChD,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import type { ToolDef } from "./types.js";
|
|
17
|
+
export declare const top10Holders: ToolDef;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import { callDataPlane } from "../transport.js";
|
|
17
|
+
import { withCache } from "../cache.js";
|
|
18
|
+
export const top10Holders = {
|
|
19
|
+
name: "get_top10_holders",
|
|
20
|
+
description: "获取单只 A 股十大股东最新一期(姓名/持股数/持股比例/性质)。本数据按季度更新,默认 6h 缓存。",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: { symbol: { type: "string", description: "6 位 A 股代码" } },
|
|
24
|
+
required: ["symbol"],
|
|
25
|
+
},
|
|
26
|
+
handler: async (args, client) => {
|
|
27
|
+
const symbol = args.symbol;
|
|
28
|
+
return withCache(`tool:get_top10_holders:${symbol}`, 6 * 60 * 60 * 1000, async () => {
|
|
29
|
+
const r = await callDataPlane(client, `/v1/stocks/${encodeURIComponent(symbol)}/holders/top10`);
|
|
30
|
+
if (r.error)
|
|
31
|
+
return { error: true, ...r.error };
|
|
32
|
+
return { data: r.data, meta: r.meta };
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top10-holders.js","sourceRoot":"","sources":["../../src/tools/top10-holders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,YAAY,GAAY;IACnC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,qDAAqD;IAClE,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE;QACpE,QAAQ,EAAE,CAAC,QAAQ,CAAC;KACrB;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAgB,CAAC;QACrC,OAAO,SAAS,CAAC,0BAA0B,MAAM,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE;YAClF,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,cAAc,kBAAkB,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;YAChG,IAAI,CAAC,CAAC,KAAK;gBAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;YAChD,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import type { ToolDef } from "./types.js";
|
|
17
|
+
export declare const tradeDays: ToolDef;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import { callDataPlane } from "../transport.js";
|
|
17
|
+
import { withCache } from "../cache.js";
|
|
18
|
+
export const tradeDays = {
|
|
19
|
+
name: "get_trade_days",
|
|
20
|
+
description: "获取 A 股交易日历(年度)。year 默认当年。本数据跨年才变,默认 24h 缓存。",
|
|
21
|
+
inputSchema: {
|
|
22
|
+
type: "object",
|
|
23
|
+
properties: {
|
|
24
|
+
year: { type: "integer", description: "年份 YYYY,默认当年" },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
handler: async (args, client) => {
|
|
28
|
+
const year = args.year ?? new Date().getFullYear();
|
|
29
|
+
return withCache(`tool:get_trade_days:${year}`, 24 * 60 * 60 * 1000, async () => {
|
|
30
|
+
const r = await callDataPlane(client, "/v1/calendar/trade-days", { year });
|
|
31
|
+
if (r.error)
|
|
32
|
+
return { error: true, ...r.error };
|
|
33
|
+
return { data: r.data, meta: r.meta };
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trade-days.js","sourceRoot":"","sources":["../../src/tools/trade-days.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,MAAM,CAAC,MAAM,SAAS,GAAY;IAChC,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,6CAA6C;IAC1D,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE;SACvD;KACF;IACD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QAC9B,MAAM,IAAI,GAAI,IAAI,CAAC,IAAe,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC/D,OAAO,SAAS,CAAC,uBAAuB,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,EAAE,KAAK,IAAI,EAAE;YAC9E,MAAM,CAAC,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,yBAAyB,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3E,IAAI,CAAC,CAAC,KAAK;gBAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;YAChD,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
import type { AxiosInstance } from "axios";
|
|
17
|
+
/**
|
|
18
|
+
* MCP Tool 定义统一接口。
|
|
19
|
+
*/
|
|
20
|
+
export interface ToolDef {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: "object";
|
|
25
|
+
properties: Record<string, unknown>;
|
|
26
|
+
required?: string[];
|
|
27
|
+
};
|
|
28
|
+
handler: (args: Record<string, unknown>, client: AxiosInstance) => Promise<unknown>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
*
|
|
14
|
+
* @author Chill
|
|
15
|
+
*/
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG"}
|