gm-mcp 1.3.21 → 2.0.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/dist/env.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import z from "zod/v3";
1
+ import z from "zod";
2
2
  declare const envSchema: z.ZodObject<{
3
3
  DASH_URL: z.ZodString;
4
4
  PASSWORD: z.ZodString;
@@ -8,7 +8,7 @@ declare const envSchema: z.ZodObject<{
8
8
  LARK_APP_SECRET: z.ZodString;
9
9
  LARK_X3_GROUP_ID: z.ZodString;
10
10
  LARK_X3_TEMPLATE_ID: z.ZodString;
11
- SEND_MESSAGE_TO_LARK: z.ZodString;
11
+ SEND_MESSAGE_TO_LARK: z.ZodBoolean;
12
12
  }, "strip", z.ZodTypeAny, {
13
13
  DASH_URL: string;
14
14
  PASSWORD: string;
@@ -18,7 +18,7 @@ declare const envSchema: z.ZodObject<{
18
18
  LARK_APP_SECRET: string;
19
19
  LARK_X3_GROUP_ID: string;
20
20
  LARK_X3_TEMPLATE_ID: string;
21
- SEND_MESSAGE_TO_LARK: string;
21
+ SEND_MESSAGE_TO_LARK: boolean;
22
22
  }, {
23
23
  DASH_URL: string;
24
24
  PASSWORD: string;
@@ -28,7 +28,7 @@ declare const envSchema: z.ZodObject<{
28
28
  LARK_APP_SECRET: string;
29
29
  LARK_X3_GROUP_ID: string;
30
30
  LARK_X3_TEMPLATE_ID: string;
31
- SEND_MESSAGE_TO_LARK: string;
31
+ SEND_MESSAGE_TO_LARK: boolean;
32
32
  }>;
33
33
  export type GimoMcpEnv = z.infer<typeof envSchema>;
34
34
  export declare function ensureEnvVariables(): boolean;
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 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" }),
8
+ const zod_1 = __importDefault(require("zod"));
9
+ const envSchema = zod_1.default.object({
10
+ DASH_URL: zod_1.default.string({ description: "Dash url for login" }),
11
+ PASSWORD: zod_1.default.string({ description: "User password" }),
12
+ USER_NAME: zod_1.default.string({ description: "User name" }),
13
+ LENDING_URL: zod_1.default.string({ description: "Lending url" }),
14
+ LARK_APP_ID: zod_1.default.string({ description: `Lark's Bot app id` }),
15
+ LARK_APP_SECRET: zod_1.default.string({ description: `Lark's Bot app secret` }),
16
+ LARK_X3_GROUP_ID: zod_1.default.string({ description: `Id of lark's group x3` }),
17
+ LARK_X3_TEMPLATE_ID: zod_1.default.string({ description: `Id of lark's card template x3` }),
18
+ SEND_MESSAGE_TO_LARK: zod_1.default.boolean({ description: "Send message to lark or not", coerce: true }),
19
19
  });
20
20
  function ensureEnvVariables() {
21
21
  const { success, error } = envSchema.safeParse(process.env);
@@ -34,7 +34,7 @@ function getEnv() {
34
34
  const LARK_APP_SECRET = process.env["LARK_APP_SECRET"];
35
35
  const LARK_X3_GROUP_ID = process.env["LARK_X3_GROUP_ID"];
36
36
  const LARK_X3_TEMPLATE_ID = process.env["LARK_X3_TEMPLATE_ID"];
37
- const SEND_MESSAGE_TO_LARK = process.env["SEND_MESSAGE_TO_LARK"];
37
+ const SEND_MESSAGE_TO_LARK = Boolean(process.env["SEND_MESSAGE_TO_LARK"]);
38
38
  return {
39
39
  DASH_URL,
40
40
  PASSWORD,
package/dist/index.js CHANGED
@@ -17,10 +17,10 @@ exports.server = void 0;
17
17
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
18
18
  const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
19
19
  const tools_1 = require("./tools");
20
- const v4_1 = __importDefault(require("zod/v4"));
20
+ const zod_1 = __importDefault(require("zod"));
21
21
  const env_1 = require("./env");
22
22
  const lark_tool_1 = require("./tools/lark-tool");
23
- const product_type_1 = require("./services/constants/product-type");
23
+ const accessible_tools_1 = require("./tools/accessible-tools");
24
24
  exports.server = new mcp_js_1.McpServer({
25
25
  name: "mcp-server",
26
26
  version: "1.0.0",
@@ -30,165 +30,63 @@ exports.server = new mcp_js_1.McpServer({
30
30
  },
31
31
  });
32
32
  exports.server.tool("statistic_salary_x3_today", "Get statistic salary x3 today", {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
33
- return (0, tools_1.statisticX3TodayTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true" });
33
+ return (0, tools_1.statisticX3TodayTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK });
34
34
  }));
35
35
  exports.server.tool("statistic_salary_x3_yesterday", "Get statistic salary x3 yesterday", {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
36
- return (0, tools_1.statisticX3YesterdayTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true" });
36
+ return (0, tools_1.statisticX3YesterdayTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK });
37
37
  }));
38
38
  exports.server.tool("statistic_salary_x3_this_week", "Get statistic salary x3 this week", {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
39
- return (0, tools_1.statisticX3WeekTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true" });
39
+ return (0, tools_1.statisticX3WeekTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK });
40
40
  }));
41
41
  exports.server.tool("statistic_salary_x3_month", `Get statistic salary x3 with month`, {
42
- month: v4_1.default.string().describe("Month to statistic, month must be represented with format MM/yyyy"),
42
+ month: zod_1.default.string().describe("Month to statistic, month must be represented with format MM/yyyy"),
43
43
  }, (args) => __awaiter(void 0, void 0, void 0, function* () {
44
- return (0, tools_1.statisticX3MonthTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true", month: args.month });
44
+ return (0, tools_1.statisticX3MonthTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK, month: args.month });
45
45
  }));
46
46
  exports.server.tool("statistic_salary_x3_this_month", `Get statistic salary x3 this month`, {}, (args) => __awaiter(void 0, void 0, void 0, function* () {
47
- return (0, tools_1.statisticX3ThisMonthTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true" });
47
+ return (0, tools_1.statisticX3ThisMonthTool)({ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK });
48
48
  }));
49
- // server.tool(
50
- // "statistic_salary_x3",
51
- // "Get statistic salary x3 with specific date,date must be formated in dd/mm/yyy or dd-mm-yyyy",
52
- // {
53
- // date: z.string({
54
- // description: "Date to statistic with format dd/mm/yyy or dd-mm-yyyy",
55
- // }),
56
- // },
57
- // async (args) => {
58
- // return statisticX3Tool({
59
- // date: args.date,
60
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
61
- // });
62
- // }
63
- // );
64
- // server.tool(
65
- // "statistic_salary_x3_in_range",
66
- // "Get statistic salary x3 with range of date,date must be formated in dd/mm/yyy or dd-mm-yyyy",
67
- // {
68
- // start_date: z.string({
69
- // description: "Start date to statistic with format dd/mm/yyy or dd-mm-yyyy",
70
- // }),
71
- // end_date: z.string({
72
- // description: "End date to statistic with format dd/mm/yyy or dd-mm-yyyy",
73
- // }),
74
- // },
75
- // async (args) => {
76
- // return statisticX3RangeTool({
77
- // startDateStr: args.start_date,
78
- // endDateStr: args.end_date,
79
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
80
- // });
81
- // }
82
- // );
83
- exports.server.registerTool("debt_collection", {
84
- description: `
85
- The company's debt collection, follow by these criteria (with optional criteria use default value of argument, don't ask again):
86
- - compnany name
87
- - year (optional) - default 2025
88
- - product type (optional) one of values EWA 02 - 03 | EWA 04 | Lương X3 | Lương X3 - EVF , default EWA 02 - 03
89
- - month (optional) - default ""
90
-
91
- `,
92
- inputSchema: v4_1.default.object({
93
- company_name: v4_1.default.string().describe("Company name to get data"),
94
- year: v4_1.default.string().nullable().describe("Year to get company debt collection"),
95
- product_type: v4_1.default
96
- .string()
97
- .nullable()
98
- .describe("Product type to get data one of follow values EWA 02 - 03 | EWA 04 | Lương X3 | Lương X3 - EVF "),
99
- month: v4_1.default.string().nullable().describe("Month to get company debt collection"),
49
+ exports.server.tool("statistic_salary_x3", "Get statistic salary x3 with specific date,date must be formated in dd/mm/yyy or dd-mm-yyyy", {
50
+ date: zod_1.default.string({
51
+ description: "Date to statistic with format dd/mm/yyy or dd-mm-yyyy",
100
52
  }),
101
53
  }, (args) => __awaiter(void 0, void 0, void 0, function* () {
102
- const { company_name, product_type, month, year } = args;
54
+ return (0, tools_1.statisticX3Tool)({
55
+ date: args.date,
56
+ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK,
57
+ });
58
+ }));
59
+ exports.server.tool("statistic_salary_x3_in_range", "Get statistic salary x3 with range of date,date must be formated in dd/mm/yyy or dd-mm-yyyy", {
60
+ start_date: zod_1.default.string({
61
+ description: "Start date to statistic with format dd/mm/yyy or dd-mm-yyyy",
62
+ }),
63
+ end_date: zod_1.default.string({
64
+ description: "End date to statistic with format dd/mm/yyy or dd-mm-yyyy",
65
+ }),
66
+ }, (args) => __awaiter(void 0, void 0, void 0, function* () {
67
+ return (0, tools_1.statisticX3RangeTool)({
68
+ startDateStr: args.start_date,
69
+ endDateStr: args.end_date,
70
+ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK,
71
+ });
72
+ }));
73
+ exports.server.tool("debt_collection_by_month", "The company's debt collection rate by month", {
74
+ month: zod_1.default.string({ description: "Month to get data, month must be represented with format MM/yyyy" }),
75
+ company_name: zod_1.default.string({ description: "Company name to get data" }),
76
+ }, (args) => __awaiter(void 0, void 0, void 0, function* () {
77
+ const { month, company_name } = args;
103
78
  return (0, lark_tool_1.debtCollectionRateTool)({
104
- sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK === "true",
105
- companyName: company_name || "",
106
- productType: product_type || product_type_1.PRODUCT_TYPE.EWA_02_03,
107
- month: month || "",
108
- year: year || "",
79
+ sendMessageToLark: (0, env_1.getEnv)().SEND_MESSAGE_TO_LARK,
80
+ monthDate: month,
81
+ companyName: company_name,
109
82
  });
110
83
  }));
111
- // server.tool(
112
- // "debt_collection_with_month",
113
- // "The company's debt collection information with month",
114
- // {
115
- // month: z
116
- // .string()
117
- // .describe(
118
- // "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"
119
- // ),
120
- // company_name: z.string({ description: "Company name to get data" }),
121
- // },
122
- // async (args) => {
123
- // const { month, company_name } = args;
124
- // return debtCollectionRateTool({
125
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
126
- // monthDate: month,
127
- // companyName: company_name,
128
- // productType: PRODUCT_TYPE.EWA_02_03,
129
- // });
130
- // }
131
- // );
132
- // server.tool(
133
- // "debt_collection_ewa_02",
134
- // "The company's debt collection information with EWA 02 - 03 product type",
135
- // {
136
- // company_name: z.string({ description: "Company name to get data" }),
137
- // },
138
- // async (args) => {
139
- // const { company_name } = args;
140
- // return debtCollectionRateTool({
141
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
142
- // companyName: company_name,
143
- // productType: PRODUCT_TYPE.EWA_02_03,
144
- // });
145
- // }
146
- // );
147
- // server.tool(
148
- // "debt_collection_ewa_04",
149
- // "The company's debt collection information with EWA 04 product type",
150
- // {
151
- // company_name: z.string({ description: "Company name to get data" }),
152
- // },
153
- // async (args) => {
154
- // const { company_name } = args;
155
- // return debtCollectionRateTool({
156
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
157
- // companyName: company_name,
158
- // productType: PRODUCT_TYPE.EWA_04,
159
- // });
160
- // }
161
- // );
162
- // server.tool(
163
- // "debt_collection_x3",
164
- // "The company's debt collection information with Lương X3 product type",
165
- // {
166
- // company_name: z.string({ description: "Company name to get data" }),
167
- // },
168
- // async (args) => {
169
- // const { company_name } = args;
170
- // return debtCollectionRateTool({
171
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
172
- // companyName: company_name,
173
- // productType: PRODUCT_TYPE.X3,
174
- // });
175
- // }
176
- // );
177
- // server.tool(
178
- // "debt_collection_x3_evf",
179
- // "The company's debt collection information with Lương X3 - EVF product type",
180
- // {
181
- // company_name: z.string({ description: "Company name to get data" }),
182
- // },
183
- // async (args) => {
184
- // const { company_name } = args;
185
- // return debtCollectionRateTool({
186
- // sendMessageToLark: getEnv().SEND_MESSAGE_TO_LARK === "true",
187
- // companyName: company_name,
188
- // productType: PRODUCT_TYPE.X3_EVF,
189
- // });
190
- // }
191
- // );
84
+ exports.server.tool("get_accessible", "By given customer phone number, awnser the question why they don't access their balance", {
85
+ phone_number: zod_1.default.string({ description: "Customer's phone number" }),
86
+ }, (args) => __awaiter(void 0, void 0, void 0, function* () {
87
+ const { phone_number } = args;
88
+ return (0, accessible_tools_1.accessibleTool)(phone_number);
89
+ }));
192
90
  function bootstap() {
193
91
  (0, env_1.ensureEnvVariables)();
194
92
  const transport = new stdio_js_1.StdioServerTransport();
@@ -1,3 +1,4 @@
1
- import { Gimo } from './types';
1
+ import { Gimo } from "./types";
2
2
  export declare function getAccessToken(): Promise<string>;
3
- export declare function findCustomerEWAByPhonenumber(phoneNumber: string): Promise<Gimo.CustomerEWA>;
3
+ export declare function findCustomerEWAByPhonenumber(phoneNumber: string): Promise<Gimo.CustomerEWA | null>;
4
+ export declare function findCustomerEWAById(id: number): Promise<Gimo.CustomerEWA>;
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.getAccessToken = getAccessToken;
16
16
  exports.findCustomerEWAByPhonenumber = findCustomerEWAByPhonenumber;
17
+ exports.findCustomerEWAById = findCustomerEWAById;
17
18
  const axios_1 = __importDefault(require("axios"));
18
19
  const env_1 = require("../env");
19
20
  function getAccessToken() {
@@ -36,13 +37,32 @@ function findCustomerEWAByPhonenumber(phoneNumber) {
36
37
  .get(customerApiUrl, {
37
38
  params: { phone_number: phoneNumber },
38
39
  headers: {
39
- Authorization: 'Bearer ' + access_token,
40
+ Authorization: "Bearer " + access_token,
40
41
  },
41
42
  })
42
43
  .then((res) => res.data)
43
44
  .then((res) => res.content);
44
45
  // Select first customer
45
- const customer = customers === null || customers === void 0 ? void 0 : customers[0];
46
+ const foundedCustomer = customers === null || customers === void 0 ? void 0 : customers[0];
47
+ if (!foundedCustomer) {
48
+ return null;
49
+ }
50
+ return findCustomerEWAById(foundedCustomer.customer_id);
51
+ });
52
+ }
53
+ function findCustomerEWAById(id) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ const customerApiUrl = `${(0, env_1.getEnv)().DASH_URL}/api/v1/admin/customers/ewa/${id}`;
56
+ const access_token = yield getAccessToken();
57
+ // Find inlist
58
+ const customer = yield axios_1.default
59
+ .get(customerApiUrl, {
60
+ headers: {
61
+ Authorization: "Bearer " + access_token,
62
+ },
63
+ })
64
+ .then((res) => res.data);
65
+ // Select first customer
46
66
  return customer || null;
47
67
  });
48
68
  }
@@ -1,15 +1,5 @@
1
1
  import { LarkRecord } from "./types/lark.type";
2
- export declare function fetchLarkBaseRecords(p: {
2
+ export declare function fetchReportRecords(p: {
3
3
  view_id: string;
4
4
  field_names: string[];
5
- app_token: string;
6
- table_id: string;
7
- page_size: number;
8
- page_token?: string;
9
- }): Promise<{
10
- items: LarkRecord[];
11
- page_token: string;
12
- has_more: boolean;
13
- total: number;
14
- }>;
15
- export declare function fetchDebtCollectionRecords(page_token?: string): Promise<LarkRecord[]>;
5
+ }): Promise<LarkRecord[]>;
@@ -12,48 +12,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.fetchLarkBaseRecords = fetchLarkBaseRecords;
16
- exports.fetchDebtCollectionRecords = fetchDebtCollectionRecords;
15
+ exports.fetchReportRecords = fetchReportRecords;
17
16
  const axios_1 = __importDefault(require("axios"));
18
17
  const lark_service_1 = require("./lark.service");
19
- const report_columns_1 = require("./constants/report-columns");
20
- // Must replace by env config later
21
- const DEBT_COLLECTION_VIEW_ID = "vewI23hNnx";
22
- const DEBT_COLLECTION_TABLE_ID = "tblQGKjGd8MnK5qs";
23
- const DEBT_COLLECTION_APP_TOKEN = "V5akbIXqfaBvXqs8twfl6rALgLd";
24
- function fetchLarkBaseRecords(p) {
18
+ function fetchReportRecords(p) {
25
19
  return __awaiter(this, void 0, void 0, function* () {
26
20
  const access_token = yield (0, lark_service_1.getLarkTenantAccessToken)();
27
- const { view_id, table_id, app_token, field_names, page_size, page_token } = p;
28
21
  const appToken = "V5akbIXqfaBvXqs8twfl6rALgLd";
29
22
  const tableId = "tblQGKjGd8MnK5qs";
30
- const url = `https://open.larksuite.com/open-apis/bitable/v1/apps/${app_token}/tables/${table_id}/records/search`;
23
+ const url = `https://open.larksuite.com/open-apis/bitable/v1/apps/${appToken}/tables/${tableId}/records/search`;
31
24
  return axios_1.default
32
- .post(url, { view_id, field_names }, {
33
- params: { page_size, page_token },
25
+ .post(url, p, {
26
+ params: { page_size: 500 },
34
27
  headers: {
35
28
  Authorization: "Bearer " + access_token,
36
29
  },
37
30
  })
38
- .then((res) => res.data.data);
39
- });
40
- }
41
- function fetchDebtCollectionRecords(page_token) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- const fieldNames = report_columns_1.REPORT_COLUMS.map((item) => item.field_name);
44
- const { has_more, items, page_token: nextPageToken, total, } = yield fetchLarkBaseRecords({
45
- view_id: DEBT_COLLECTION_VIEW_ID,
46
- field_names: fieldNames,
47
- app_token: DEBT_COLLECTION_APP_TOKEN,
48
- table_id: DEBT_COLLECTION_TABLE_ID,
49
- page_size: 500,
50
- page_token: page_token,
51
- });
52
- console.log(total);
53
- if (!has_more) {
54
- return items;
55
- }
56
- const result = [...items];
57
- return result.concat(yield fetchDebtCollectionRecords(nextPageToken));
31
+ .then((res) => res.data.data.items);
58
32
  });
59
33
  }
@@ -9,29 +9,42 @@ export declare namespace Gimo {
9
9
  }
10
10
  interface CustomerEWA {
11
11
  customer_id: number;
12
+ customer_service_id: number;
12
13
  customer_full_name: string;
13
- customer_code?: string;
14
- identify_number?: string;
15
- employee_id?: number;
16
- employee_code?: string;
17
- partner_id?: number;
18
- partner_name?: string;
19
- debt_collection_type?: string;
20
- onboard_method?: string;
21
- verification_status?: string;
22
- working_status: string;
23
- dda_status?: string;
24
- ewa_longest_over_due_day: string;
25
- ewa_debt_amount?: number;
26
- ewa_status?: string;
14
+ customer_code: string;
15
+ identify_number: string;
27
16
  customer_phone_number: string;
17
+ employee_id: number;
18
+ employee_code: string;
19
+ partner_id: number;
20
+ partner_name: string;
21
+ debt_collection_type: string;
22
+ onboard_method: string;
23
+ verification_status: boolean;
24
+ working_status: string;
25
+ dda_status: string;
26
+ ewa_longest_over_due_day: any;
27
+ ewa_due_debt_amount: any;
28
+ ewa_over_due_debt_amount: any;
29
+ ewa_status: string;
30
+ ekyc_status: string;
28
31
  created_at: string;
29
32
  updated_at: string;
30
- bank_full_name?: string;
31
- bank_id?: number;
32
- bank_name?: string;
33
- bank_acc_number?: string;
34
- customer_service_id?: number;
33
+ bank_full_name: string;
34
+ bank_acc_number: string;
35
+ bank_id: number;
36
+ bank_name: string;
37
+ log_id: any;
38
+ log_ewa_status: any;
39
+ log_type: any;
40
+ log_user_id: any;
41
+ log_username: any;
42
+ log_description: any;
43
+ log_created_at: any;
44
+ source: any;
45
+ sale_code: any;
46
+ created_by: any;
47
+ b_score: any;
35
48
  }
36
49
  interface Customer {
37
50
  id: number;
package/dist/test.js CHANGED
@@ -8,39 +8,16 @@ 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
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- const zod_1 = __importDefault(require("zod"));
16
12
  const env_1 = require("./env");
13
+ const lark_tool_1 = require("./tools/lark-tool");
17
14
  function setupTest() {
18
15
  return __awaiter(this, void 0, void 0, function* () {
19
16
  (0, env_1.ensureEnvVariables)();
20
- console.log(JSON.stringify(zod_1.default
21
- .object({
22
- company_name: zod_1.default.string().describe("Company name to get data"),
23
- year: zod_1.default.string().describe("Year to get company debt collection").default("2025").optional(),
24
- product_type: zod_1.default
25
- .string()
26
- .nullable()
27
- .describe("Product type to get data one of follow values EWA 02 - 03 | EWA 04 | Lương X3 | Lương X3 - EVF "),
28
- month: zod_1.default.string().nullable().describe("Month to get company debt collection").default("").optional(),
29
- })
30
- .toJSONSchema()));
31
- // const res = zodToJsonSchema();
32
- // console.log(res);
33
- // const r = await fetchDebtCollectionRecords();
34
- // console.log(r.length);
35
- // const compnay = "BGG";
36
- // const month = "12/2025";
37
- // const res = await debtCollectionRateTool({
38
- // sendMessageToLark: true,
39
- // companyName: "Tkg",
40
- // // monthDate: "8/2025",
41
- // productType: PRODUCT_TYPE.X3_EVF,
42
- // });
43
- // console.log(res);
17
+ const compnay = "BGG";
18
+ const month = "12/2025";
19
+ const res = yield (0, lark_tool_1.debtCollectionRateTool)({ sendMessageToLark: false, companyName: compnay, monthDate: month });
20
+ console.log(res);
44
21
  // const fieldNames = REPORT_COLUMS.map((item) => item.field_name);
45
22
  // try {
46
23
  // const records = await fetchReportRecords({ view_id: "vewI23hNnx", field_names: fieldNames });
@@ -0,0 +1,2 @@
1
+ import { CallToolResult } from "@modelcontextprotocol/sdk/types";
2
+ export declare function accessibleTool(phoneNumber: string): Promise<CallToolResult>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.accessibleTool = accessibleTool;
13
+ const gimo_service_1 = require("../services/gimo.service");
14
+ function accessibleTool(phoneNumber) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ try {
17
+ const customer = yield (0, gimo_service_1.findCustomerEWAByPhonenumber)(phoneNumber);
18
+ if (!customer) {
19
+ throw "Customer not found";
20
+ }
21
+ const currentInformation = {
22
+ ewa_status: customer === null || customer === void 0 ? void 0 : customer.ewa_status,
23
+ dda: customer === null || customer === void 0 ? void 0 : customer.dda_status,
24
+ seniority: 1,
25
+ };
26
+ const validInformation = {
27
+ ewa_status: "active",
28
+ dda: "REGISTERED",
29
+ seniority: ">= 0.3 năm",
30
+ };
31
+ const returnData = {
32
+ current_information: currentInformation,
33
+ valid_information: validInformation,
34
+ };
35
+ return { content: [{ type: "text", text: JSON.stringify(returnData) }] };
36
+ }
37
+ catch (error) {
38
+ return {
39
+ content: [
40
+ {
41
+ type: "text",
42
+ text: "Oh no,có rồi, thử lại nhé " + error,
43
+ },
44
+ ],
45
+ };
46
+ }
47
+ });
48
+ }
@@ -2,8 +2,5 @@ import { CallToolResult } from "@modelcontextprotocol/sdk/types";
2
2
  export declare function debtCollectionRateTool(options: {
3
3
  sendMessageToLark: boolean;
4
4
  companyName: string;
5
- monthDate?: string;
6
- productType?: string;
7
- month?: string;
8
- year?: string;
5
+ monthDate: string;
9
6
  }): Promise<CallToolResult>;