@znt/mcp 1.0.7 → 1.0.8
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/README.md +1 -1
- package/index.js +14 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
* `role` *(string)*: Фильтр по архитектурной роли (`"controller"`, `"service"`, `"repository"`, `"model"`).
|
|
48
48
|
* `type` *(string)*: Фильтр по типу узла AST (`"function"`, `"struct"`, `"class"`, `"interface"`).
|
|
49
49
|
* `file_pattern` *(string)*: Маска пути файла (например `"pkg/semantic/*"` или `"*.go"`).
|
|
50
|
-
* `
|
|
50
|
+
* `mode` *(string)*: Режим поиска: `"hybrid"` (RRF гибридный), `"lexical"` (точный BM25/FTS5), `"vector"` (чисто векторный). По умолчанию `"hybrid"`.
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
package/index.js
CHANGED
|
@@ -347,7 +347,8 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
|
347
347
|
type: 'object',
|
|
348
348
|
properties: {
|
|
349
349
|
path: { type: 'string', description: 'Относительный или абсолютный путь к целевому файлу (например: "internal/engine/server.go")' },
|
|
350
|
-
include_code: { type: 'boolean', description: 'Включать ли фрагменты/сигнатуры исходного кода для каждого символа' }
|
|
350
|
+
include_code: { type: 'boolean', description: 'Включать ли фрагменты/сигнатуры исходного кода для каждого символа' },
|
|
351
|
+
format: { type: 'string', description: 'Формат ответа: "text" (сверхкомпактный атлас строк, экономит до 75% токенов) или "json"' }
|
|
351
352
|
},
|
|
352
353
|
required: ['path']
|
|
353
354
|
},
|
|
@@ -410,9 +411,7 @@ async function callZntApi(endpoint, method = 'GET', body = null) {
|
|
|
410
411
|
throw new Error(data.content);
|
|
411
412
|
}
|
|
412
413
|
} catch (err) {
|
|
413
|
-
|
|
414
|
-
throw err;
|
|
415
|
-
}
|
|
414
|
+
// Ignore parse errors
|
|
416
415
|
}
|
|
417
416
|
}
|
|
418
417
|
}
|
|
@@ -420,6 +419,11 @@ async function callZntApi(endpoint, method = 'GET', body = null) {
|
|
|
420
419
|
return { content: text };
|
|
421
420
|
}
|
|
422
421
|
|
|
422
|
+
const contentType = response.headers.get('content-type') || '';
|
|
423
|
+
if (contentType.includes('text/plain')) {
|
|
424
|
+
return response.text();
|
|
425
|
+
}
|
|
426
|
+
|
|
423
427
|
return response.json();
|
|
424
428
|
}
|
|
425
429
|
|
|
@@ -506,6 +510,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
506
510
|
const maxCodeLines = parseInt(request.params.arguments?.max_code_lines, 10) || 30;
|
|
507
511
|
const role = request.params.arguments?.role || '';
|
|
508
512
|
const nodeType = request.params.arguments?.type || '';
|
|
513
|
+
const filePattern = request.params.arguments?.file_pattern || '';
|
|
509
514
|
const mode = request.params.arguments?.mode || (request.params.arguments?.hybrid === false ? 'lexical' : 'hybrid');
|
|
510
515
|
|
|
511
516
|
const apiParams = new URLSearchParams({
|
|
@@ -516,6 +521,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
516
521
|
include_code: includeCode.toString(),
|
|
517
522
|
max_code_lines: maxCodeLines.toString(),
|
|
518
523
|
mode: mode,
|
|
524
|
+
format: 'text'
|
|
519
525
|
});
|
|
520
526
|
if (compact) apiParams.set('compact', 'true');
|
|
521
527
|
if (role) apiParams.set('role', role);
|
|
@@ -594,11 +600,15 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
594
600
|
break;
|
|
595
601
|
}
|
|
596
602
|
const includeCode = Boolean(request.params.arguments?.include_code);
|
|
603
|
+
const format = request.params.arguments?.format || '';
|
|
597
604
|
|
|
598
605
|
const queryParams = new URLSearchParams({
|
|
599
606
|
path: filePath,
|
|
600
607
|
include_code: includeCode.toString(),
|
|
601
608
|
});
|
|
609
|
+
if (format) {
|
|
610
|
+
queryParams.set('format', format);
|
|
611
|
+
}
|
|
602
612
|
|
|
603
613
|
const resData = await callZntApi(`/api/file/outline?${queryParams.toString()}`);
|
|
604
614
|
result = resData;
|