@hubex/mcp 0.5.20260909 → 0.6.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.
|
@@ -53,7 +53,7 @@ function buildEntry(service, method, path, op, doc) {
|
|
|
53
53
|
service,
|
|
54
54
|
method,
|
|
55
55
|
path,
|
|
56
|
-
summary: op.summary || op.description || `${method} ${path}`,
|
|
56
|
+
summary: op.summary || fallbackSummary(op.description) || `${method} ${path}`,
|
|
57
57
|
tags: Array.isArray(op.tags) ? [...op.tags] : [],
|
|
58
58
|
pathParams,
|
|
59
59
|
queryParams,
|
|
@@ -61,6 +61,21 @@ function buildEntry(service, method, path, op, doc) {
|
|
|
61
61
|
bodyRequired: Boolean(bodySchema) && op.requestBody?.required === true,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
/** Максимальная длина summary, собранного из description. */
|
|
65
|
+
const MAX_FALLBACK_SUMMARY = 200;
|
|
66
|
+
/**
|
|
67
|
+
* Запасной summary из description: описания в swagger — многострочный markdown
|
|
68
|
+
* с примерами запроса и ответа, а в индексе и выдаче поиска нужна одна строка.
|
|
69
|
+
* Полный текст остаётся в hubex_describe_endpoint.
|
|
70
|
+
*/
|
|
71
|
+
function fallbackSummary(description) {
|
|
72
|
+
if (typeof description !== "string")
|
|
73
|
+
return "";
|
|
74
|
+
const firstLine = description.split(/\r?\n/, 1)[0].trim();
|
|
75
|
+
return firstLine.length > MAX_FALLBACK_SUMMARY
|
|
76
|
+
? firstLine.slice(0, MAX_FALLBACK_SUMMARY) + "…"
|
|
77
|
+
: firstLine;
|
|
78
|
+
}
|
|
64
79
|
/** Стабильная сериализация: два прогона дают побайтово одинаковый результат. */
|
|
65
80
|
export function serializeIndex(index) {
|
|
66
81
|
return JSON.stringify(index, null, 2) + "\n";
|
package/dist/schema/describe.js
CHANGED
|
@@ -43,6 +43,7 @@ export class SchemaProvider {
|
|
|
43
43
|
method: entry.method,
|
|
44
44
|
path: entry.path,
|
|
45
45
|
summary: entry.summary,
|
|
46
|
+
description: typeof op.description === "string" ? op.description : undefined,
|
|
46
47
|
pathParams,
|
|
47
48
|
queryParams,
|
|
48
49
|
body: bodySchema ? deref(bodySchema, doc) : undefined,
|
package/dist/tools/discovery.js
CHANGED
|
@@ -134,7 +134,8 @@ function describeEndpoint(deps) {
|
|
|
134
134
|
return {
|
|
135
135
|
definition: {
|
|
136
136
|
name: "hubex_describe_endpoint",
|
|
137
|
-
description: "Полная схема параметров и тела
|
|
137
|
+
description: "Полная схема параметров и тела плюс описание операции из swagger (примеры запроса и ответа, негативные " +
|
|
138
|
+
"сценарии, требуемые права) для конкретных эндпоинтов. Идентификаторы берутся из hubex_search_*_endpoints " +
|
|
138
139
|
"или из гайда. Вызывай только для тех эндпоинтов, которые собираешься выполнить: схемы объёмные.",
|
|
139
140
|
inputSchema: {
|
|
140
141
|
type: "object",
|
package/package.json
CHANGED