@ser3nd1pity/rts-validator-mcp 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.
Files changed (2) hide show
  1. package/index.js +125 -0
  2. package/package.json +23 -0
package/index.js ADDED
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { McpServer } from "@modelcontextprotocol/server";
4
+ import { serveStdio } from "@modelcontextprotocol/server/stdio";
5
+ import * as z from "zod/v4";
6
+
7
+ function names(items = []) {
8
+ return items
9
+ .map((item) => typeof item === "string" ? item : item?.name)
10
+ .filter(Boolean);
11
+ }
12
+
13
+ function createServer() {
14
+ const server = new McpServer({
15
+ name: "rts-validator-mcp",
16
+ version: "0.1.0"
17
+ });
18
+
19
+ server.registerTool(
20
+ "validate_screening_result",
21
+ {
22
+ description: "校验简历初筛结果的分层、推荐榜、标签、人数和措辞一致性。",
23
+ inputSchema: z.object({
24
+ layers: z.record(z.string(), z.array(z.any())).default({}),
25
+ recommendation_ranking: z.array(z.any()).default([]),
26
+ final_recommendation_names: z.array(z.string()).default([]),
27
+ report_text: z.string().default("")
28
+ })
29
+ },
30
+ async ({
31
+ layers,
32
+ recommendation_ranking,
33
+ final_recommendation_names,
34
+ report_text
35
+ }) => {
36
+ const issues = [];
37
+ const A = layers.A ?? [];
38
+ const B = layers.B ?? [];
39
+ const C = layers.C ?? [];
40
+ const D = layers.D ?? [];
41
+ const E = layers.E ?? [];
42
+
43
+ const aNames = names(A);
44
+ const rankingNames = names(recommendation_ranking);
45
+
46
+ if (JSON.stringify(aNames) !== JSON.stringify(rankingNames)) {
47
+ issues.push("A组名单与推荐排序榜名单不一致。");
48
+ }
49
+
50
+ if (
51
+ final_recommendation_names.length > 0 &&
52
+ JSON.stringify(aNames) !== JSON.stringify(final_recommendation_names)
53
+ ) {
54
+ issues.push("A组名单与结尾推荐名单不一致。");
55
+ }
56
+
57
+ for (const candidate of A) {
58
+ const name = candidate.name ?? "未命名候选人";
59
+ const match = Number(candidate.match_score ?? candidate.matchScore ?? 0);
60
+ const trust = Number(candidate.trust_score ?? candidate.trustScore ?? 0);
61
+ const label = String(candidate.label ?? "");
62
+
63
+ if (match < 70) {
64
+ issues.push(`${name} 在A组但匹配度低于70。`);
65
+ }
66
+
67
+ if (trust < 70) {
68
+ issues.push(`${name} 在A组但可信度低于70。`);
69
+ }
70
+
71
+ if (label.includes("可进入面试")) {
72
+ issues.push(`${name} 在A组但标签为“可进入面试”。`);
73
+ }
74
+ }
75
+
76
+ for (const candidate of B) {
77
+ const label = String(candidate.label ?? "");
78
+ if (label.includes("建议补充材料")) {
79
+ issues.push(`${candidate.name ?? "未命名候选人"} 在B组但标签为“建议补充材料”。`);
80
+ }
81
+ }
82
+
83
+ const bannedWords = ["造假", "不诚信", "可放心排除", "淘汰"];
84
+ for (const word of bannedWords) {
85
+ if (report_text.includes(word)) {
86
+ issues.push(`报告中出现不建议使用的措辞:“${word}”。`);
87
+ }
88
+ }
89
+
90
+ if (A.length === 0 && report_text.includes("推荐排序榜")) {
91
+ issues.push("A组为空时不应输出推荐排序榜。");
92
+ }
93
+
94
+ if (E.some((candidate) =>
95
+ candidate.match_score !== undefined ||
96
+ candidate.trust_score !== undefined ||
97
+ candidate.matchScore !== undefined ||
98
+ candidate.trustScore !== undefined
99
+ )) {
100
+ issues.push("解析失败候选人不应具有匹配度或可信度评分。");
101
+ }
102
+
103
+ const result = {
104
+ valid: issues.length === 0,
105
+ issues,
106
+ summary: issues.length === 0
107
+ ? "校验通过"
108
+ : `发现 ${issues.length} 个一致性问题`
109
+ };
110
+
111
+ return {
112
+ content: [
113
+ {
114
+ type: "text",
115
+ text: JSON.stringify(result, null, 2)
116
+ }
117
+ ]
118
+ };
119
+ }
120
+ );
121
+
122
+ return server;
123
+ }
124
+
125
+ void serveStdio(createServer);
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@ser3nd1pity/rts-validator-mcp",
3
+ "version": "0.1.0",
4
+ "main": "index.js",
5
+ "scripts": {
6
+ "test": "echo \"Error: no test specified\" && exit 1"
7
+ },
8
+ "keywords": [],
9
+ "author": "",
10
+ "license": "ISC",
11
+ "description": "",
12
+ "type": "module",
13
+ "bin": {
14
+ "rts-validator-mcp": "index.js"
15
+ },
16
+ "dependencies": {
17
+ "@modelcontextprotocol/server": "^2.0.0",
18
+ "zod": "^4.6.5"
19
+ },
20
+ "files": [
21
+ "index.js"
22
+ ]
23
+ }