gm-mcp 1.3.13 → 1.3.15
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/dist/index.js +5 -5
- package/dist/test.js +15 -6
- package/dist/tools/lark-tool.js +2 -2
- package/package.json +3 -2
- package/src/index.ts +5 -5
- package/src/test.ts +16 -7
- package/src/tools/lark-tool.ts +2 -2
package/dist/index.js
CHANGED
|
@@ -82,11 +82,11 @@ exports.server.tool("statistic_salary_x3_this_month", `Get statistic salary x3 t
|
|
|
82
82
|
// );
|
|
83
83
|
exports.server.registerTool("debt_collection", {
|
|
84
84
|
description: `
|
|
85
|
-
The company's debt collection, follow by these criteria (with optional criteria use default value, don't ask again):
|
|
85
|
+
The company's debt collection, follow by these criteria (with optional criteria use default value of argument, don't ask again):
|
|
86
86
|
- compnany name
|
|
87
|
-
- year (optional)
|
|
88
|
-
- product (optional)
|
|
89
|
-
- month (optional)
|
|
87
|
+
- year (optional)
|
|
88
|
+
- product (optional)
|
|
89
|
+
- month (optional)
|
|
90
90
|
|
|
91
91
|
`,
|
|
92
92
|
inputSchema: v4_1.default.object({
|
|
@@ -102,7 +102,7 @@ exports.server.registerTool("debt_collection", {
|
|
|
102
102
|
.default(product_type_1.PRODUCT_TYPE.EWA_02_03)
|
|
103
103
|
.optional(),
|
|
104
104
|
month: v4_1.default.string().describe("Month to get company debt collection").default("").optional(),
|
|
105
|
-
})
|
|
105
|
+
}),
|
|
106
106
|
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
107
107
|
const { company_name, product_type, month, year } = args;
|
|
108
108
|
return (0, lark_tool_1.debtCollectionRateTool)({
|
package/dist/test.js
CHANGED
|
@@ -14,15 +14,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const zod_1 = __importDefault(require("zod"));
|
|
16
16
|
const env_1 = require("./env");
|
|
17
|
-
const
|
|
17
|
+
const product_type_1 = require("./services/constants/product-type");
|
|
18
18
|
function setupTest() {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
(0, env_1.ensureEnvVariables)();
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
console.log(zod_1.default
|
|
22
|
+
.object({
|
|
23
|
+
company_name: zod_1.default.string().describe("Company name to get data"),
|
|
24
|
+
year: zod_1.default.string().describe("Year to get company debt collection").default("2025").optional(),
|
|
25
|
+
product_type: zod_1.default
|
|
26
|
+
.string()
|
|
27
|
+
.describe("Product type to get data one of follow values EWA 02 - 03 | EWA 04 | Lương X3 | Lương X3 - EVF ")
|
|
28
|
+
.default(product_type_1.PRODUCT_TYPE.EWA_02_03)
|
|
29
|
+
.optional(),
|
|
30
|
+
month: zod_1.default.string().describe("Month to get company debt collection").default("").optional(),
|
|
31
|
+
})
|
|
32
|
+
.toJSONSchema());
|
|
33
|
+
// const res = zodToJsonSchema();
|
|
34
|
+
// console.log(res);
|
|
26
35
|
// const r = await fetchDebtCollectionRecords();
|
|
27
36
|
// console.log(r.length);
|
|
28
37
|
// const compnay = "BGG";
|
package/dist/tools/lark-tool.js
CHANGED
|
@@ -26,7 +26,7 @@ function debtCollectionRateTool(options) {
|
|
|
26
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
var _c, _d;
|
|
28
28
|
const { sendMessageToLark, companyName, monthDate, productType, month, year } = options;
|
|
29
|
-
if (!VALID_YEARS.includes(year || "")) {
|
|
29
|
+
if (!VALID_YEARS.includes(year || "") && sendMessageToLark) {
|
|
30
30
|
yield (0, lark_service_1.sendReportOpsGroup)({
|
|
31
31
|
title: ["Tỉ lệ thu nợ", companyName].filter(Boolean).join(" - "),
|
|
32
32
|
message_content: `Rất tiếc tôi chưa có dữ liệu của năm ${year}, bạn hãy thử lại với năm ${VALID_YEARS.join(",")}`,
|
|
@@ -75,7 +75,7 @@ function debtCollectionRateTool(options) {
|
|
|
75
75
|
// console.log(foundRecords);
|
|
76
76
|
// const finalCompnay = companiesMatchName.find((item) => item.fields["KỲ LƯƠNG"] === foundMonth);
|
|
77
77
|
// console.log(finalCompnay);
|
|
78
|
-
if (foundRecords.length === 0) {
|
|
78
|
+
if (foundRecords.length === 0 && sendMessageToLark) {
|
|
79
79
|
yield (0, lark_service_1.sendReportOpsGroup)({
|
|
80
80
|
title: ["Tỉ lệ thu nợ", foundName, productType].filter(Boolean).join(" - "),
|
|
81
81
|
message_content: `Rất tiếc, Tôi chưa có thông tin`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gm-mcp",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"description": "Mcp server for Gm",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"currency-formatter": "^1.5.9",
|
|
30
30
|
"date-fns": "^2.30.0",
|
|
31
31
|
"date-fns-tz": "^2.0.1",
|
|
32
|
-
"zod": "^
|
|
32
|
+
"zod": "^4.2.1",
|
|
33
|
+
"zod-to-json-schema": "^3.25.0"
|
|
33
34
|
}
|
|
34
35
|
}
|
package/src/index.ts
CHANGED
|
@@ -94,11 +94,11 @@ server.registerTool(
|
|
|
94
94
|
"debt_collection",
|
|
95
95
|
{
|
|
96
96
|
description: `
|
|
97
|
-
The company's debt collection, follow by these criteria (with optional criteria use default value, don't ask again):
|
|
97
|
+
The company's debt collection, follow by these criteria (with optional criteria use default value of argument, don't ask again):
|
|
98
98
|
- compnany name
|
|
99
|
-
- year (optional)
|
|
100
|
-
- product (optional)
|
|
101
|
-
- month (optional)
|
|
99
|
+
- year (optional)
|
|
100
|
+
- product (optional)
|
|
101
|
+
- month (optional)
|
|
102
102
|
|
|
103
103
|
`,
|
|
104
104
|
inputSchema: z.object({
|
|
@@ -114,7 +114,7 @@ server.registerTool(
|
|
|
114
114
|
.default(PRODUCT_TYPE.EWA_02_03)
|
|
115
115
|
.optional(),
|
|
116
116
|
month: z.string().describe("Month to get company debt collection").default("").optional(),
|
|
117
|
-
})
|
|
117
|
+
}),
|
|
118
118
|
},
|
|
119
119
|
async (args) => {
|
|
120
120
|
const { company_name, product_type, month, year } = args;
|
package/src/test.ts
CHANGED
|
@@ -17,15 +17,24 @@ import { PRODUCT_TYPE } from "./services/constants/product-type";
|
|
|
17
17
|
|
|
18
18
|
async function setupTest() {
|
|
19
19
|
ensureEnvVariables();
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
console.log(
|
|
21
|
+
z
|
|
22
|
+
.object({
|
|
23
|
+
company_name: z.string().describe("Company name to get data"),
|
|
24
|
+
year: z.string().describe("Year to get company debt collection").default("2025").optional(),
|
|
25
|
+
product_type: z
|
|
26
|
+
.string()
|
|
27
|
+
.describe("Product type to get data one of follow values EWA 02 - 03 | EWA 04 | Lương X3 | Lương X3 - EVF ")
|
|
28
|
+
.default(PRODUCT_TYPE.EWA_02_03)
|
|
29
|
+
.optional(),
|
|
30
|
+
month: z.string().describe("Month to get company debt collection").default("").optional(),
|
|
31
|
+
})
|
|
32
|
+
.toJSONSchema()
|
|
26
33
|
);
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
// const res = zodToJsonSchema();
|
|
36
|
+
|
|
37
|
+
// console.log(res);
|
|
29
38
|
|
|
30
39
|
// const r = await fetchDebtCollectionRecords();
|
|
31
40
|
// console.log(r.length);
|
package/src/tools/lark-tool.ts
CHANGED
|
@@ -24,7 +24,7 @@ export async function debtCollectionRateTool(options: {
|
|
|
24
24
|
year?: string;
|
|
25
25
|
}): Promise<CallToolResult> {
|
|
26
26
|
const { sendMessageToLark, companyName, monthDate, productType, month, year } = options;
|
|
27
|
-
if (!VALID_YEARS.includes(year || "")) {
|
|
27
|
+
if (!VALID_YEARS.includes(year || "") && sendMessageToLark) {
|
|
28
28
|
await sendReportOpsGroup({
|
|
29
29
|
title: ["Tỉ lệ thu nợ", companyName].filter(Boolean).join(" - "),
|
|
30
30
|
message_content: `Rất tiếc tôi chưa có dữ liệu của năm ${year}, bạn hãy thử lại với năm ${VALID_YEARS.join(",")}`,
|
|
@@ -74,7 +74,7 @@ export async function debtCollectionRateTool(options: {
|
|
|
74
74
|
// console.log(foundRecords);
|
|
75
75
|
// const finalCompnay = companiesMatchName.find((item) => item.fields["KỲ LƯƠNG"] === foundMonth);
|
|
76
76
|
// console.log(finalCompnay);
|
|
77
|
-
if (foundRecords.length === 0) {
|
|
77
|
+
if (foundRecords.length === 0 && sendMessageToLark) {
|
|
78
78
|
await sendReportOpsGroup({
|
|
79
79
|
title: ["Tỉ lệ thu nợ", foundName, productType].filter(Boolean).join(" - "),
|
|
80
80
|
message_content: `Rất tiếc, Tôi chưa có thông tin`,
|