@ww_nero/skills 2.3.0 → 2.4.1
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/index.js +15 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -214,7 +214,17 @@ const buildSnippet = (title, workingDirectory) => {
|
|
|
214
214
|
const outputPath = path.join(workingDir, entry.codeFile);
|
|
215
215
|
fs.writeFileSync(outputPath, code);
|
|
216
216
|
|
|
217
|
-
|
|
217
|
+
const lines = [];
|
|
218
|
+
lines.push(`示例脚本已经存储到工作目录下,文件名: ${entry.codeFile},可直接作为工具模块导入使用。`);
|
|
219
|
+
if (entry.notes && entry.notes.length > 0) {
|
|
220
|
+
lines.push('');
|
|
221
|
+
lines.push('注意事项:');
|
|
222
|
+
entry.notes.forEach((note, idx) => {
|
|
223
|
+
lines.push(`${idx + 1}. ${note}`);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
return lines.join('\n');
|
|
218
228
|
};
|
|
219
229
|
|
|
220
230
|
const buildGuide = (title) => {
|
|
@@ -235,7 +245,7 @@ const listTools = () => ({
|
|
|
235
245
|
tools: [
|
|
236
246
|
{
|
|
237
247
|
name: 'snippet',
|
|
238
|
-
description: '将常见文件转换的 Python
|
|
248
|
+
description: '将常见文件转换的 Python 参考脚本保存到工作目录下(可直接作为工具模块使用),返回文件名和注意事项',
|
|
239
249
|
inputSchema: {
|
|
240
250
|
type: 'object',
|
|
241
251
|
properties: {
|
|
@@ -270,7 +280,7 @@ const listTools = () => ({
|
|
|
270
280
|
]
|
|
271
281
|
});
|
|
272
282
|
|
|
273
|
-
const server = new Server({ name: 'skills', version: '2.
|
|
283
|
+
const server = new Server({ name: 'skills', version: '2.4.1' }, { capabilities: { tools: {} } });
|
|
274
284
|
|
|
275
285
|
server.setRequestHandler(ListToolsRequestSchema, async () => listTools());
|
|
276
286
|
|
|
@@ -283,8 +293,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
283
293
|
if (!working_directory || !title) {
|
|
284
294
|
throw new Error('必须同时提供 working_directory 和 title 参数');
|
|
285
295
|
}
|
|
286
|
-
const
|
|
287
|
-
return { content: [{ type: 'text', text:
|
|
296
|
+
const result = buildSnippet(title, working_directory);
|
|
297
|
+
return { content: [{ type: 'text', text: result }] };
|
|
288
298
|
}
|
|
289
299
|
|
|
290
300
|
if (name === 'guide') {
|