@ppdocs/mcp 2.6.23 → 2.6.24
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/tools/index.js +14 -2
- package/package.json +1 -1
package/dist/tools/index.js
CHANGED
|
@@ -142,8 +142,8 @@ export function registerTools(server, projectId, _user) {
|
|
|
142
142
|
return wrap(projectId, node ? JSON.stringify(node, null, 2) : '操作失败');
|
|
143
143
|
});
|
|
144
144
|
// 5. 搜索节点
|
|
145
|
-
server.tool('kg_search', '
|
|
146
|
-
keywords: z.array(z.string()).describe('关键词列表(OR逻辑)'),
|
|
145
|
+
server.tool('kg_search', '关键词搜索节点,按命中率排序返回。空白关键词[""]返回全部节点', {
|
|
146
|
+
keywords: z.array(z.string()).describe('关键词列表(OR逻辑),空白[""]返回全部'),
|
|
147
147
|
limit: z.number().optional().describe('返回数量(默认10)')
|
|
148
148
|
}, async (args) => {
|
|
149
149
|
const results = await storage.searchNodes(projectId, args.keywords, args.limit || 10);
|
|
@@ -158,6 +158,18 @@ export function registerTools(server, projectId, _user) {
|
|
|
158
158
|
const json = JSON.stringify(output, null, 2);
|
|
159
159
|
return wrap(projectId, `${json}\n\n💡 需要详细内容请使用 kg_read_node(nodeId) 获取节点详情`);
|
|
160
160
|
});
|
|
161
|
+
// 5.5 列出所有标签
|
|
162
|
+
server.tool('kg_list_tags', '获取所有节点使用过的标签列表(去重)', {}, async () => {
|
|
163
|
+
const nodes = await storage.listNodes(projectId);
|
|
164
|
+
const tagSet = new Set();
|
|
165
|
+
for (const node of nodes) {
|
|
166
|
+
if (node.categories && Array.isArray(node.categories)) {
|
|
167
|
+
node.categories.forEach(cat => tagSet.add(cat));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const tags = Array.from(tagSet).sort();
|
|
171
|
+
return wrap(projectId, JSON.stringify({ total: tags.length, tags }, null, 2));
|
|
172
|
+
});
|
|
161
173
|
// 6. 路径查找
|
|
162
174
|
server.tool('kg_find_path', '查找两节点间的依赖路径', {
|
|
163
175
|
startId: z.string().describe('起点节点ID'),
|