gm-mcp 1.1.23 → 1.1.25
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/env.d.ts +1 -1
- package/dist/env.js +11 -11
- package/dist/index.js +24 -12
- package/dist/test.js +14 -3
- package/package.json +1 -1
- package/src/env.ts +1 -1
- package/src/index.ts +25 -18
- package/src/test.ts +13 -2
package/dist/env.d.ts
CHANGED
package/dist/env.js
CHANGED
|
@@ -5,17 +5,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ensureEnvVariables = ensureEnvVariables;
|
|
7
7
|
exports.getEnv = getEnv;
|
|
8
|
-
const
|
|
9
|
-
const envSchema =
|
|
10
|
-
DASH_URL:
|
|
11
|
-
PASSWORD:
|
|
12
|
-
USER_NAME:
|
|
13
|
-
LENDING_URL:
|
|
14
|
-
LARK_APP_ID:
|
|
15
|
-
LARK_APP_SECRET:
|
|
16
|
-
LARK_X3_GROUP_ID:
|
|
17
|
-
LARK_X3_TEMPLATE_ID:
|
|
18
|
-
SEND_MESSAGE_TO_LARK:
|
|
8
|
+
const v3_1 = __importDefault(require("zod/v3"));
|
|
9
|
+
const envSchema = v3_1.default.object({
|
|
10
|
+
DASH_URL: v3_1.default.string({ description: "Dash url for login" }),
|
|
11
|
+
PASSWORD: v3_1.default.string({ description: "User password" }),
|
|
12
|
+
USER_NAME: v3_1.default.string({ description: "User name" }),
|
|
13
|
+
LENDING_URL: v3_1.default.string({ description: "Lending url" }),
|
|
14
|
+
LARK_APP_ID: v3_1.default.string({ description: `Lark's Bot app id` }),
|
|
15
|
+
LARK_APP_SECRET: v3_1.default.string({ description: `Lark's Bot app secret` }),
|
|
16
|
+
LARK_X3_GROUP_ID: v3_1.default.string({ description: `Id of lark's group x3` }),
|
|
17
|
+
LARK_X3_TEMPLATE_ID: v3_1.default.string({ description: `Id of lark's card template x3` }),
|
|
18
|
+
SEND_MESSAGE_TO_LARK: v3_1.default.string({ description: "Send message to lark or not" }),
|
|
19
19
|
});
|
|
20
20
|
function ensureEnvVariables() {
|
|
21
21
|
const { success, error } = envSchema.safeParse(process.env);
|
package/dist/index.js
CHANGED
|
@@ -71,27 +71,39 @@ exports.server.tool("statistic_salary_x3_in_range", "Get statistic salary x3 wit
|
|
|
71
71
|
}));
|
|
72
72
|
exports.server.tool("debt_collection", "The company's debt collection information", {
|
|
73
73
|
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
74
|
-
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
75
|
-
const { company_name } = args;
|
|
76
|
-
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
77
|
-
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
78
|
-
// monthDate: month || "",
|
|
79
|
-
companyName: company_name,
|
|
80
|
-
});
|
|
81
|
-
}));
|
|
82
|
-
exports.server.tool("debt_collection_with_month", "The company's debt collection information with month", {
|
|
83
74
|
month: zod_1.default
|
|
84
75
|
.string()
|
|
76
|
+
.optional()
|
|
85
77
|
.describe("Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"),
|
|
86
|
-
company_name: zod_1.default.string({ description: "Company name to get data" }),
|
|
87
78
|
}, (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
|
-
const {
|
|
79
|
+
const { company_name } = args;
|
|
89
80
|
return (0, lark_tool_1.debtCollectionRateTool)({
|
|
90
81
|
sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
|
|
91
|
-
monthDate: month,
|
|
82
|
+
// monthDate: month || "",
|
|
92
83
|
companyName: company_name,
|
|
93
84
|
});
|
|
94
85
|
}));
|
|
86
|
+
// server.tool(
|
|
87
|
+
// "debt_collection_with_month",
|
|
88
|
+
// "The company's debt collection information with month",
|
|
89
|
+
// {
|
|
90
|
+
// month: z
|
|
91
|
+
// .string()
|
|
92
|
+
// .optional()
|
|
93
|
+
// .describe(
|
|
94
|
+
// "Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"
|
|
95
|
+
// ),
|
|
96
|
+
// company_name: z.string({ description: "Company name to get data" }),
|
|
97
|
+
// },
|
|
98
|
+
// async (args) => {
|
|
99
|
+
// const { month, company_name } = args;
|
|
100
|
+
// return debtCollectionRateTool({
|
|
101
|
+
// sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
102
|
+
// monthDate: month,
|
|
103
|
+
// companyName: company_name,
|
|
104
|
+
// });
|
|
105
|
+
// }
|
|
106
|
+
// );
|
|
95
107
|
function bootstap() {
|
|
96
108
|
(0, env_1.ensureEnvVariables)();
|
|
97
109
|
const transport = new stdio_js_1.StdioServerTransport();
|
package/dist/test.js
CHANGED
|
@@ -8,18 +8,29 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const v3_1 = __importDefault(require("zod/v3"));
|
|
12
16
|
const env_1 = require("./env");
|
|
13
|
-
const
|
|
17
|
+
const zod_to_json_schema_1 = require("zod-to-json-schema");
|
|
14
18
|
function setupTest() {
|
|
15
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
20
|
(0, env_1.ensureEnvVariables)();
|
|
21
|
+
const mySchema = v3_1.default
|
|
22
|
+
.object({
|
|
23
|
+
myString: v3_1.default.string().min(5).optional(),
|
|
24
|
+
})
|
|
25
|
+
.describe("My neat object schema");
|
|
26
|
+
const res1 = (0, zod_to_json_schema_1.zodToJsonSchema)(mySchema);
|
|
27
|
+
console.log(res1);
|
|
17
28
|
// const r = await fetchDebtCollectionRecords();
|
|
18
29
|
// console.log(r.length);
|
|
19
30
|
// const compnay = "BGG";
|
|
20
31
|
// const month = "12/2025";
|
|
21
|
-
const res =
|
|
22
|
-
console.log(res);
|
|
32
|
+
// const res = await debtCollectionRateTool({ sendMessageToLark: true, companyName: 'SHYANG', monthDate: '07/2025' });
|
|
33
|
+
// console.log(res);
|
|
23
34
|
// const fieldNames = REPORT_COLUMS.map((item) => item.field_name);
|
|
24
35
|
// try {
|
|
25
36
|
// const records = await fetchReportRecords({ view_id: "vewI23hNnx", field_names: fieldNames });
|
package/package.json
CHANGED
package/src/env.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -94,38 +94,45 @@ server.tool(
|
|
|
94
94
|
"The company's debt collection information",
|
|
95
95
|
{
|
|
96
96
|
company_name: z.string({ description: "Company name to get data" }),
|
|
97
|
-
},
|
|
98
|
-
async (args) => {
|
|
99
|
-
const { company_name } = args;
|
|
100
|
-
return debtCollectionRateTool({
|
|
101
|
-
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
102
|
-
// monthDate: month || "",
|
|
103
|
-
companyName: company_name,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
server.tool(
|
|
109
|
-
"debt_collection_with_month",
|
|
110
|
-
"The company's debt collection information with month",
|
|
111
|
-
{
|
|
112
97
|
month: z
|
|
113
98
|
.string()
|
|
99
|
+
.optional()
|
|
114
100
|
.describe(
|
|
115
101
|
"Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"
|
|
116
102
|
),
|
|
117
|
-
company_name: z.string({ description: "Company name to get data" }),
|
|
118
103
|
},
|
|
119
104
|
async (args) => {
|
|
120
|
-
const {
|
|
105
|
+
const { company_name } = args;
|
|
121
106
|
return debtCollectionRateTool({
|
|
122
107
|
sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
123
|
-
monthDate: month,
|
|
108
|
+
// monthDate: month || "",
|
|
124
109
|
companyName: company_name,
|
|
125
110
|
});
|
|
126
111
|
}
|
|
127
112
|
);
|
|
128
113
|
|
|
114
|
+
// server.tool(
|
|
115
|
+
// "debt_collection_with_month",
|
|
116
|
+
// "The company's debt collection information with month",
|
|
117
|
+
// {
|
|
118
|
+
// month: z
|
|
119
|
+
// .string()
|
|
120
|
+
// .optional()
|
|
121
|
+
// .describe(
|
|
122
|
+
// "Month to get data,if year is not provided, please use current year (in Vietnam timezone) instead of, month is represented with format MM/yyyy"
|
|
123
|
+
// ),
|
|
124
|
+
// company_name: z.string({ description: "Company name to get data" }),
|
|
125
|
+
// },
|
|
126
|
+
// async (args) => {
|
|
127
|
+
// const { month, company_name } = args;
|
|
128
|
+
// return debtCollectionRateTool({
|
|
129
|
+
// sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
|
|
130
|
+
// monthDate: month,
|
|
131
|
+
// companyName: company_name,
|
|
132
|
+
// });
|
|
133
|
+
// }
|
|
134
|
+
// );
|
|
135
|
+
|
|
129
136
|
function bootstap() {
|
|
130
137
|
ensureEnvVariables();
|
|
131
138
|
const transport: StdioServerTransport = new StdioServerTransport();
|
package/src/test.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import z from "zod/v3";
|
|
1
2
|
import { ensureEnvVariables, getEnv } from "./env";
|
|
2
3
|
import { searchLike } from "./helpers/search-like";
|
|
3
4
|
import { REPORT_COLUMS } from "./services/constants/report-columns";
|
|
@@ -11,17 +12,27 @@ import {
|
|
|
11
12
|
statisticX3YesterdayTool,
|
|
12
13
|
} from "./tools";
|
|
13
14
|
import { debtCollectionRateTool } from "./tools/lark-tool";
|
|
15
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
14
16
|
|
|
15
17
|
async function setupTest() {
|
|
16
18
|
ensureEnvVariables();
|
|
17
19
|
|
|
20
|
+
const mySchema = z
|
|
21
|
+
.object({
|
|
22
|
+
myString: z.string().min(5).optional(),
|
|
23
|
+
})
|
|
24
|
+
.describe("My neat object schema");
|
|
25
|
+
|
|
26
|
+
const res1 = zodToJsonSchema(mySchema);
|
|
27
|
+
console.log(res1);
|
|
28
|
+
|
|
18
29
|
// const r = await fetchDebtCollectionRecords();
|
|
19
30
|
// console.log(r.length);
|
|
20
31
|
|
|
21
32
|
// const compnay = "BGG";
|
|
22
33
|
// const month = "12/2025";
|
|
23
|
-
const res = await debtCollectionRateTool({ sendMessageToLark: true, companyName: 'SHYANG', monthDate: '07/2025' });
|
|
24
|
-
console.log(res);
|
|
34
|
+
// const res = await debtCollectionRateTool({ sendMessageToLark: true, companyName: 'SHYANG', monthDate: '07/2025' });
|
|
35
|
+
// console.log(res);
|
|
25
36
|
|
|
26
37
|
// const fieldNames = REPORT_COLUMS.map((item) => item.field_name);
|
|
27
38
|
// try {
|