@smartbear/mcp 0.29.0 → 0.31.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.
- package/dist/bearq/client.js +2 -6
- package/dist/bearq/tool/tasks/delete-test-cases.js +53 -0
- package/dist/common/server.js +5 -1
- package/dist/package.json.js +1 -1
- package/dist/pactflow/client/tools.js +408 -0
- package/dist/pactflow/client.js +4 -11
- package/dist/reflect/client.js +5 -1
- package/dist/reflect/tool/tests/create-segment.js +18 -0
- package/dist/reflect/tool/tests/create-test.js +18 -0
- package/dist/reflect/tool/tests/definition.js +190 -0
- package/dist/swagger/client/functional-testing-api.js +111 -121
- package/dist/swagger/client/functional-testing-tools.js +10 -1
- package/dist/swagger/client/functional-testing-types.js +6 -0
- package/dist/swagger/client/portal-types.js +144 -10
- package/dist/swagger/client/registry-types.js +60 -1
- package/dist/swagger/client/tool-constants.js +20 -0
- package/dist/swagger/client/tools.js +87 -29
- package/dist/swagger/client/user-management-types.js +14 -0
- package/dist/swagger/client.js +8 -2
- package/package.json +1 -1
- package/dist/bearq/tool/tasks/refine-all-draft-tests.js +0 -28
- package/dist/bearq/tool/tasks/refine-test-cases.js +0 -31
- package/dist/bearq/tool/tasks/refine-tests-in-functional-areas.js +0 -35
|
@@ -61,20 +61,40 @@ const CreateTableOfContentsArgsSchema = z.object({
|
|
|
61
61
|
"Content type - 'apiUrl' for API references, 'html' for HTML content, or 'markdown' for Markdown content"
|
|
62
62
|
),
|
|
63
63
|
source: z.enum(["internal", "external"]).optional().describe(
|
|
64
|
-
"Source of the document content - 'internal' allows to edit content in both UI and API, 'external' enables editing only via API."
|
|
64
|
+
"Source of the document content - 'internal' allows to edit content in both UI and API, 'external' enables editing only via API. Not used when type is 'apiUrl'."
|
|
65
65
|
),
|
|
66
66
|
url: z.string().optional().describe(
|
|
67
|
-
"URL for API reference content
|
|
67
|
+
"URL for API reference content - required when type is 'apiUrl', must end with '/swagger.json' or '/swagger.yaml'. Not used for 'html'/'markdown'."
|
|
68
68
|
),
|
|
69
|
-
apiSpec: z.string().nullable().optional().describe(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
(
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
apiSpec: z.string().nullable().optional().describe(
|
|
70
|
+
"API specification format for API URL content - only used when type is 'apiUrl'"
|
|
71
|
+
),
|
|
72
|
+
documentId: z.string().nullable().optional().describe(
|
|
73
|
+
"Document ID for HTML or Markdown content - only used when type is 'html' or 'markdown'"
|
|
74
|
+
)
|
|
75
|
+
}).meta({
|
|
76
|
+
// Structural rule (in addition to the .refine() below) so the generated
|
|
77
|
+
// JSON Schema states which fields are required per content.type, instead
|
|
78
|
+
// of leaving every field optional with the constraint only in prose.
|
|
79
|
+
allOf: [
|
|
80
|
+
{
|
|
81
|
+
if: { properties: { type: { const: "apiUrl" } } },
|
|
82
|
+
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then/else keyword, not a thenable
|
|
83
|
+
then: { required: ["url"], properties: { documentId: false } },
|
|
84
|
+
message: "URL is required when content type is 'apiUrl'"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
if: { properties: { type: { enum: ["html", "markdown"] } } },
|
|
88
|
+
// biome-ignore lint/suspicious/noThenProperty: JSON Schema if/then/else keyword, not a thenable
|
|
89
|
+
then: { properties: { url: false, apiSpec: false } },
|
|
90
|
+
message: "url must not be set when content type is 'html' or 'markdown'"
|
|
75
91
|
}
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
]
|
|
93
|
+
}).optional().describe("Content configuration for the table of contents item").refine((content) => content?.type !== "apiUrl" || !!content.url, {
|
|
94
|
+
message: "URL is required when content type is 'apiUrl'",
|
|
95
|
+
path: ["url"]
|
|
96
|
+
}).refine(
|
|
97
|
+
(content) => content?.type !== "apiUrl" || !content.url || content.url.endsWith("/swagger.json") || content.url.endsWith("/swagger.yaml"),
|
|
78
98
|
{
|
|
79
99
|
message: "URL must end with '/swagger.json' or '/swagger.yaml' when content type is 'apiUrl'",
|
|
80
100
|
path: ["url"]
|
|
@@ -237,19 +257,133 @@ const CreateDocumentationPageArgsSchema = z.object({
|
|
|
237
257
|
"Parent table of contents item ID - null for top-level pages, or ID of parent item for nested structure"
|
|
238
258
|
)
|
|
239
259
|
});
|
|
260
|
+
const PageSchema = z.object({
|
|
261
|
+
number: z.number().optional(),
|
|
262
|
+
size: z.number().optional(),
|
|
263
|
+
totalElements: z.number().optional(),
|
|
264
|
+
totalPages: z.number().optional()
|
|
265
|
+
});
|
|
266
|
+
const PortalOutputSchema = z.looseObject({
|
|
267
|
+
id: z.string().optional(),
|
|
268
|
+
name: z.string().optional(),
|
|
269
|
+
subdomain: z.string().optional(),
|
|
270
|
+
customDomain: z.string().optional(),
|
|
271
|
+
offline: z.boolean().optional(),
|
|
272
|
+
openapiRenderer: z.string().optional(),
|
|
273
|
+
routing: z.string().optional(),
|
|
274
|
+
credentialsEnabled: z.boolean().optional(),
|
|
275
|
+
swaggerHubOrganizationId: z.string().optional()
|
|
276
|
+
});
|
|
277
|
+
const PortalsListOutputSchema = z.object({
|
|
278
|
+
page: PageSchema.optional(),
|
|
279
|
+
items: z.array(PortalOutputSchema).optional()
|
|
280
|
+
});
|
|
281
|
+
const ProductOutputSchema = z.looseObject({
|
|
282
|
+
id: z.string().optional(),
|
|
283
|
+
name: z.string().optional(),
|
|
284
|
+
slug: z.string().optional(),
|
|
285
|
+
portalId: z.string().optional(),
|
|
286
|
+
description: z.string().optional(),
|
|
287
|
+
public: z.boolean().optional(),
|
|
288
|
+
hidden: z.boolean().optional()
|
|
289
|
+
});
|
|
290
|
+
const ProductsListOutputSchema = z.object({
|
|
291
|
+
page: PageSchema.optional(),
|
|
292
|
+
items: z.array(ProductOutputSchema).optional()
|
|
293
|
+
});
|
|
294
|
+
const SectionOutputSchema = z.looseObject({
|
|
295
|
+
id: z.string().optional(),
|
|
296
|
+
productId: z.string().optional(),
|
|
297
|
+
title: z.string().optional(),
|
|
298
|
+
slug: z.string().optional(),
|
|
299
|
+
order: z.number().optional()
|
|
300
|
+
});
|
|
301
|
+
const SectionsListOutputSchema = z.object({
|
|
302
|
+
page: PageSchema.optional(),
|
|
303
|
+
items: z.array(SectionOutputSchema).optional()
|
|
304
|
+
});
|
|
305
|
+
const CreateTocOutputSchema = z.object({
|
|
306
|
+
id: z.string().optional(),
|
|
307
|
+
documentId: z.string().optional()
|
|
308
|
+
});
|
|
309
|
+
const DocumentOutputSchema = z.object({
|
|
310
|
+
id: z.string().optional(),
|
|
311
|
+
type: z.enum(["html", "markdown"]).optional(),
|
|
312
|
+
source: z.enum(["internal", "external"]).optional(),
|
|
313
|
+
content: z.string().optional(),
|
|
314
|
+
createdAt: z.string().optional(),
|
|
315
|
+
updatedAt: z.string().optional()
|
|
316
|
+
});
|
|
317
|
+
const PublishOutputSchema = z.looseObject({
|
|
318
|
+
success: z.boolean().optional(),
|
|
319
|
+
preview: z.boolean().optional(),
|
|
320
|
+
liveUrl: z.string().nullable().optional(),
|
|
321
|
+
previewUrl: z.string().nullable().optional()
|
|
322
|
+
});
|
|
323
|
+
const ResolvePortalOutputSchema = z.object({
|
|
324
|
+
organizationId: z.string().optional(),
|
|
325
|
+
portalId: z.string().optional(),
|
|
326
|
+
subdomain: z.string().optional(),
|
|
327
|
+
customDomain: z.string().optional(),
|
|
328
|
+
portalCreated: z.boolean().optional(),
|
|
329
|
+
products: z.array(
|
|
330
|
+
z.object({
|
|
331
|
+
productId: z.string().optional(),
|
|
332
|
+
productSlug: z.string().optional(),
|
|
333
|
+
productName: z.string().optional()
|
|
334
|
+
})
|
|
335
|
+
).optional()
|
|
336
|
+
});
|
|
337
|
+
const CreateDocPageOutputSchema = z.looseObject({
|
|
338
|
+
productId: z.string().optional(),
|
|
339
|
+
sectionId: z.string().optional(),
|
|
340
|
+
sectionSlug: z.string().optional(),
|
|
341
|
+
draftUrl: z.string().optional()
|
|
342
|
+
});
|
|
343
|
+
const DeleteProductOutputSchema = z.object({
|
|
344
|
+
message: z.string()
|
|
345
|
+
});
|
|
346
|
+
const DeleteTableOfContentsOutputSchema = z.object({
|
|
347
|
+
success: z.boolean().optional()
|
|
348
|
+
});
|
|
349
|
+
const TocListOutputSchema = z.object({
|
|
350
|
+
items: z.array(
|
|
351
|
+
z.looseObject({
|
|
352
|
+
id: z.string().optional(),
|
|
353
|
+
slug: z.string().optional(),
|
|
354
|
+
title: z.string().optional(),
|
|
355
|
+
order: z.number().optional(),
|
|
356
|
+
parentId: z.string().nullable().optional()
|
|
357
|
+
})
|
|
358
|
+
)
|
|
359
|
+
});
|
|
240
360
|
export {
|
|
361
|
+
CreateDocPageOutputSchema,
|
|
241
362
|
CreateDocumentationPageArgsSchema,
|
|
242
363
|
CreatePortalArgsSchema,
|
|
243
364
|
CreateProductArgsSchema,
|
|
244
365
|
CreateTableOfContentsArgsSchema,
|
|
366
|
+
CreateTocOutputSchema,
|
|
367
|
+
DeleteProductOutputSchema,
|
|
245
368
|
DeleteTableOfContentsArgsSchema,
|
|
369
|
+
DeleteTableOfContentsOutputSchema,
|
|
370
|
+
DocumentOutputSchema,
|
|
246
371
|
GetDocumentArgsSchema,
|
|
247
372
|
GetProductSectionsArgsSchema,
|
|
248
373
|
GetTableOfContentsArgsSchema,
|
|
249
374
|
PortalArgsSchema,
|
|
375
|
+
PortalOutputSchema,
|
|
376
|
+
PortalsListOutputSchema,
|
|
250
377
|
ProductArgsSchema,
|
|
378
|
+
ProductOutputSchema,
|
|
379
|
+
ProductsListOutputSchema,
|
|
380
|
+
PublishOutputSchema,
|
|
251
381
|
PublishProductArgsSchema,
|
|
252
382
|
ResolveOrganizationPortalArgsSchema,
|
|
383
|
+
ResolvePortalOutputSchema,
|
|
384
|
+
SectionOutputSchema,
|
|
385
|
+
SectionsListOutputSchema,
|
|
386
|
+
TocListOutputSchema,
|
|
253
387
|
UpdateDocumentArgsSchema,
|
|
254
388
|
UpdatePortalArgsSchema,
|
|
255
389
|
UpdateProductArgsSchema
|
|
@@ -69,12 +69,71 @@ const StandardizeApiParamsSchema = z.object({
|
|
|
69
69
|
"The version to save the fixed definition as (e.g. '1.0.1'). Omitting this will overwrite the current version — prefer providing a patch bump (e.g. '1.0.0' → '1.0.1') unless the user specifies otherwise."
|
|
70
70
|
)
|
|
71
71
|
});
|
|
72
|
+
const CreateApiOutputSchema = z.looseObject({
|
|
73
|
+
owner: z.string().optional(),
|
|
74
|
+
apiName: z.string().optional(),
|
|
75
|
+
version: z.string().optional(),
|
|
76
|
+
url: z.string().optional(),
|
|
77
|
+
operation: z.enum(["create", "update"]).optional()
|
|
78
|
+
});
|
|
79
|
+
const CreateApiFromPromptOutputSchema = z.looseObject({
|
|
80
|
+
owner: z.string().optional(),
|
|
81
|
+
apiName: z.string().optional(),
|
|
82
|
+
specType: z.string().optional(),
|
|
83
|
+
version: z.string().optional(),
|
|
84
|
+
url: z.string().optional(),
|
|
85
|
+
operation: z.enum(["create", "update"]).optional()
|
|
86
|
+
});
|
|
87
|
+
const StandardizationErrorSchema = z.object({
|
|
88
|
+
line: z.number().optional(),
|
|
89
|
+
description: z.string().optional(),
|
|
90
|
+
severity: z.string().optional()
|
|
91
|
+
});
|
|
92
|
+
const ScanOutputSchema = z.looseObject({
|
|
93
|
+
count: z.number().optional(),
|
|
94
|
+
countsBySeverity: z.record(z.string(), z.number()).optional(),
|
|
95
|
+
validation: z.array(StandardizationErrorSchema).optional()
|
|
96
|
+
});
|
|
97
|
+
const ScanFromRegistryOutputSchema = z.looseObject({
|
|
98
|
+
count: z.number().optional(),
|
|
99
|
+
countsBySeverity: z.record(z.string(), z.number()).optional(),
|
|
100
|
+
validation: z.array(StandardizationErrorSchema).optional(),
|
|
101
|
+
url: z.string().optional()
|
|
102
|
+
});
|
|
103
|
+
const StandardizeOutputSchema = z.looseObject({
|
|
104
|
+
message: z.string().optional(),
|
|
105
|
+
errorsFound: z.number().optional(),
|
|
106
|
+
fixedDefinition: z.string().optional(),
|
|
107
|
+
savedVersion: z.string().optional()
|
|
108
|
+
});
|
|
109
|
+
const ApiDefinitionOutputSchema = z.object({
|
|
110
|
+
definition: z.string()
|
|
111
|
+
});
|
|
112
|
+
const SearchApisOutputSchema = z.object({
|
|
113
|
+
items: z.array(
|
|
114
|
+
z.looseObject({
|
|
115
|
+
owner: z.string().optional(),
|
|
116
|
+
name: z.string().optional(),
|
|
117
|
+
version: z.string().optional(),
|
|
118
|
+
description: z.string().optional(),
|
|
119
|
+
specification: z.string().optional(),
|
|
120
|
+
url: z.string().optional()
|
|
121
|
+
})
|
|
122
|
+
)
|
|
123
|
+
});
|
|
72
124
|
export {
|
|
125
|
+
ApiDefinitionOutputSchema,
|
|
73
126
|
ApiDefinitionParamsSchema,
|
|
74
127
|
ApiSearchParamsSchema,
|
|
128
|
+
CreateApiFromPromptOutputSchema,
|
|
75
129
|
CreateApiFromPromptParamsSchema,
|
|
130
|
+
CreateApiOutputSchema,
|
|
76
131
|
CreateApiParamsSchema,
|
|
77
132
|
ScanApiStandardizationFromRegistryParamsSchema,
|
|
133
|
+
ScanFromRegistryOutputSchema,
|
|
134
|
+
ScanOutputSchema,
|
|
78
135
|
ScanStandardizationParamsSchema,
|
|
79
|
-
|
|
136
|
+
SearchApisOutputSchema,
|
|
137
|
+
StandardizeApiParamsSchema,
|
|
138
|
+
StandardizeOutputSchema
|
|
80
139
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const READ_ONLY = {
|
|
2
|
+
readOnly: true,
|
|
3
|
+
openWorld: false,
|
|
4
|
+
destructive: false
|
|
5
|
+
};
|
|
6
|
+
const WRITE = {
|
|
7
|
+
readOnly: false,
|
|
8
|
+
openWorld: true,
|
|
9
|
+
destructive: false
|
|
10
|
+
};
|
|
11
|
+
const WRITE_DESTRUCTIVE = {
|
|
12
|
+
readOnly: false,
|
|
13
|
+
openWorld: true,
|
|
14
|
+
destructive: true
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
READ_ONLY,
|
|
18
|
+
WRITE,
|
|
19
|
+
WRITE_DESTRUCTIVE
|
|
20
|
+
};
|
|
@@ -1,112 +1,144 @@
|
|
|
1
1
|
import { FUNCTIONAL_TESTING_TOOLS } from "./functional-testing-tools.js";
|
|
2
|
-
import { CreatePortalArgsSchema, PortalArgsSchema, UpdatePortalArgsSchema, ResolveOrganizationPortalArgsSchema, CreateProductArgsSchema, ProductArgsSchema, UpdateProductArgsSchema, PublishProductArgsSchema, GetProductSectionsArgsSchema, CreateTableOfContentsArgsSchema, GetTableOfContentsArgsSchema, DeleteTableOfContentsArgsSchema, CreateDocumentationPageArgsSchema, GetDocumentArgsSchema, UpdateDocumentArgsSchema } from "./portal-types.js";
|
|
3
|
-
import { ApiSearchParamsSchema, ApiDefinitionParamsSchema, CreateApiParamsSchema, ScanStandardizationParamsSchema, ScanApiStandardizationFromRegistryParamsSchema, CreateApiFromPromptParamsSchema, StandardizeApiParamsSchema } from "./registry-types.js";
|
|
4
|
-
import {
|
|
2
|
+
import { PortalsListOutputSchema, PortalOutputSchema, CreatePortalArgsSchema, PortalArgsSchema, UpdatePortalArgsSchema, ResolvePortalOutputSchema, ResolveOrganizationPortalArgsSchema, ProductsListOutputSchema, ProductOutputSchema, CreateProductArgsSchema, ProductArgsSchema, DeleteProductOutputSchema, UpdateProductArgsSchema, PublishOutputSchema, PublishProductArgsSchema, SectionsListOutputSchema, GetProductSectionsArgsSchema, CreateTocOutputSchema, CreateTableOfContentsArgsSchema, TocListOutputSchema, GetTableOfContentsArgsSchema, DeleteTableOfContentsOutputSchema, DeleteTableOfContentsArgsSchema, CreateDocPageOutputSchema, CreateDocumentationPageArgsSchema, DocumentOutputSchema, GetDocumentArgsSchema, UpdateDocumentArgsSchema } from "./portal-types.js";
|
|
3
|
+
import { SearchApisOutputSchema, ApiSearchParamsSchema, ApiDefinitionOutputSchema, ApiDefinitionParamsSchema, CreateApiOutputSchema, CreateApiParamsSchema, ScanOutputSchema, ScanStandardizationParamsSchema, ScanFromRegistryOutputSchema, ScanApiStandardizationFromRegistryParamsSchema, CreateApiFromPromptOutputSchema, CreateApiFromPromptParamsSchema, StandardizeOutputSchema, StandardizeApiParamsSchema } from "./registry-types.js";
|
|
4
|
+
import { READ_ONLY, WRITE, WRITE_DESTRUCTIVE } from "./tool-constants.js";
|
|
5
|
+
import { OrganizationsListOutputSchema, OrganizationsQuerySchema } from "./user-management-types.js";
|
|
5
6
|
const TOOLS = [
|
|
6
7
|
{
|
|
7
8
|
title: "List Portals",
|
|
8
9
|
toolset: "Portals",
|
|
9
10
|
summary: "Search for available portals within Swagger. Only portals where you have at least a designer role, either at the product level or organization level, are returned.",
|
|
10
|
-
|
|
11
|
+
outputSchema: PortalsListOutputSchema,
|
|
12
|
+
handler: "getPortals",
|
|
13
|
+
...READ_ONLY
|
|
11
14
|
},
|
|
12
15
|
{
|
|
13
16
|
title: "Create Portal",
|
|
14
17
|
toolset: "Portals",
|
|
15
18
|
summary: "Create a new portal within Swagger.",
|
|
16
19
|
inputSchema: CreatePortalArgsSchema,
|
|
17
|
-
|
|
20
|
+
outputSchema: PortalOutputSchema,
|
|
21
|
+
handler: "createPortal",
|
|
22
|
+
...WRITE
|
|
18
23
|
},
|
|
19
24
|
{
|
|
20
25
|
title: "Get Portal",
|
|
21
26
|
toolset: "Portals",
|
|
22
27
|
summary: "Retrieve information about a specific portal.",
|
|
23
28
|
inputSchema: PortalArgsSchema,
|
|
24
|
-
|
|
29
|
+
outputSchema: PortalOutputSchema,
|
|
30
|
+
handler: "getPortal",
|
|
31
|
+
...READ_ONLY
|
|
25
32
|
},
|
|
26
33
|
{
|
|
27
34
|
title: "Update Portal",
|
|
28
35
|
toolset: "Portals",
|
|
29
36
|
summary: "Update a specific portal's configuration.",
|
|
30
37
|
inputSchema: UpdatePortalArgsSchema,
|
|
31
|
-
|
|
38
|
+
outputSchema: PortalOutputSchema,
|
|
39
|
+
handler: "updatePortal",
|
|
40
|
+
...WRITE_DESTRUCTIVE
|
|
32
41
|
},
|
|
33
42
|
{
|
|
34
43
|
title: "Resolve Organization Portal",
|
|
35
44
|
toolset: "Portals",
|
|
36
45
|
summary: "Resolve portal details for a Swagger organization in a single step. Given an organization UUID, returns the portal ID, subdomain, customDomain (when configured), and the list of products (with productId, productSlug, and productName) for the organization's portal. If the organization has no portal yet, a new portal is created automatically. Use this tool to obtain all portal context needed for subsequent portal and product operations.",
|
|
37
46
|
inputSchema: ResolveOrganizationPortalArgsSchema,
|
|
38
|
-
|
|
47
|
+
outputSchema: ResolvePortalOutputSchema,
|
|
48
|
+
handler: "resolveOrganizationPortal",
|
|
49
|
+
...WRITE
|
|
39
50
|
},
|
|
40
51
|
{
|
|
41
52
|
title: "List Portal Products",
|
|
42
53
|
toolset: "Products",
|
|
43
54
|
summary: "Get products for a specific portal that match your criteria.",
|
|
44
55
|
inputSchema: PortalArgsSchema,
|
|
45
|
-
|
|
56
|
+
outputSchema: ProductsListOutputSchema,
|
|
57
|
+
handler: "getPortalProducts",
|
|
58
|
+
...READ_ONLY
|
|
46
59
|
},
|
|
47
60
|
{
|
|
48
61
|
title: "Create Portal Product",
|
|
49
62
|
toolset: "Products",
|
|
50
63
|
summary: "Create a new product for a specific portal.",
|
|
51
64
|
inputSchema: CreateProductArgsSchema,
|
|
52
|
-
|
|
65
|
+
outputSchema: ProductOutputSchema,
|
|
66
|
+
handler: "createPortalProduct",
|
|
67
|
+
...WRITE
|
|
53
68
|
},
|
|
54
69
|
{
|
|
55
70
|
title: "Get Portal Product",
|
|
56
71
|
toolset: "Products",
|
|
57
72
|
summary: "Retrieve information about a specific product resource.",
|
|
58
73
|
inputSchema: ProductArgsSchema,
|
|
59
|
-
|
|
74
|
+
outputSchema: ProductOutputSchema,
|
|
75
|
+
handler: "getPortalProduct",
|
|
76
|
+
...READ_ONLY
|
|
60
77
|
},
|
|
61
78
|
{
|
|
62
79
|
title: "Delete Portal Product",
|
|
63
80
|
toolset: "Products",
|
|
64
81
|
summary: "Delete a product from a specific portal",
|
|
65
82
|
inputSchema: ProductArgsSchema,
|
|
83
|
+
outputSchema: DeleteProductOutputSchema,
|
|
66
84
|
handler: "deletePortalProduct",
|
|
67
|
-
formatResponse: () => "Product deleted successfully."
|
|
85
|
+
formatResponse: () => ({ message: "Product deleted successfully." }),
|
|
86
|
+
...WRITE_DESTRUCTIVE
|
|
68
87
|
},
|
|
69
88
|
{
|
|
70
89
|
title: "Update Portal Product",
|
|
71
90
|
toolset: "Products",
|
|
72
91
|
summary: "Update a product's settings within a specific portal.",
|
|
73
92
|
inputSchema: UpdateProductArgsSchema,
|
|
74
|
-
|
|
93
|
+
outputSchema: ProductOutputSchema,
|
|
94
|
+
handler: "updatePortalProduct",
|
|
95
|
+
...WRITE_DESTRUCTIVE
|
|
75
96
|
},
|
|
76
97
|
{
|
|
77
98
|
title: "Publish Portal Product",
|
|
78
99
|
toolset: "Products",
|
|
79
100
|
summary: "Publish a product's content to make it live or as preview. This endpoint publishes the current content of a product, making it visible to portal visitors. Use preview mode to test before going live. Optionally provide `tableOfContentsId` to get a page-specific URL. Returns publication status, a live or preview URL (null if URL building fails), product and portal metadata, and an optional `warning` when metadata/URL building failed — a warning does NOT mean the publish failed.",
|
|
80
101
|
inputSchema: PublishProductArgsSchema,
|
|
81
|
-
|
|
102
|
+
outputSchema: PublishOutputSchema,
|
|
103
|
+
handler: "publishPortalProduct",
|
|
104
|
+
...WRITE_DESTRUCTIVE
|
|
82
105
|
},
|
|
83
106
|
{
|
|
84
107
|
title: "List Portal Product Sections",
|
|
85
108
|
toolset: "Sections",
|
|
86
109
|
summary: "Get sections for a specific product within a portal.",
|
|
87
110
|
inputSchema: GetProductSectionsArgsSchema,
|
|
88
|
-
|
|
111
|
+
outputSchema: SectionsListOutputSchema,
|
|
112
|
+
handler: "getPortalProductSections",
|
|
113
|
+
...READ_ONLY
|
|
89
114
|
},
|
|
90
115
|
{
|
|
91
116
|
title: "Create Table Of Contents",
|
|
92
117
|
toolset: "Table Of Contents",
|
|
93
118
|
summary: "Create a new table of contents item in a portal product section. Supports API references, HTML content, and Markdown content types.",
|
|
94
119
|
inputSchema: CreateTableOfContentsArgsSchema,
|
|
95
|
-
|
|
120
|
+
outputSchema: CreateTocOutputSchema,
|
|
121
|
+
handler: "createTableOfContents",
|
|
122
|
+
...WRITE
|
|
96
123
|
},
|
|
97
124
|
{
|
|
98
125
|
title: "List Table Of Contents",
|
|
99
126
|
toolset: "Table Of Contents",
|
|
100
127
|
summary: "Get table of contents for a section of a product within a portal.",
|
|
101
128
|
inputSchema: GetTableOfContentsArgsSchema,
|
|
102
|
-
|
|
129
|
+
outputSchema: TocListOutputSchema,
|
|
130
|
+
formatResponse: (result) => ({ items: result }),
|
|
131
|
+
handler: "getTableOfContents",
|
|
132
|
+
...READ_ONLY
|
|
103
133
|
},
|
|
104
134
|
{
|
|
105
135
|
title: "Delete Table Of Contents",
|
|
106
136
|
toolset: "Table Of Contents",
|
|
107
137
|
summary: "Delete table of contents entry. Performs a soft-delete of an entry from the table of contents. Supports recursive deletion of nested items.",
|
|
108
138
|
inputSchema: DeleteTableOfContentsArgsSchema,
|
|
109
|
-
|
|
139
|
+
outputSchema: DeleteTableOfContentsOutputSchema,
|
|
140
|
+
handler: "deleteTableOfContents",
|
|
141
|
+
...WRITE_DESTRUCTIVE
|
|
110
142
|
},
|
|
111
143
|
// Document management tools
|
|
112
144
|
{
|
|
@@ -114,21 +146,27 @@ const TOOLS = [
|
|
|
114
146
|
toolset: "Documents",
|
|
115
147
|
summary: "Create a documentation page in a portal product in a single tool call. Supports markdown and html content types. Returns the page location details (productId, sectionId, slug) and a draftUrl to edit it in the portal.",
|
|
116
148
|
inputSchema: CreateDocumentationPageArgsSchema,
|
|
117
|
-
|
|
149
|
+
outputSchema: CreateDocPageOutputSchema,
|
|
150
|
+
handler: "createDocumentationPage",
|
|
151
|
+
...WRITE
|
|
118
152
|
},
|
|
119
153
|
{
|
|
120
154
|
title: "Get Document",
|
|
121
155
|
toolset: "Documents",
|
|
122
156
|
summary: "Get document content and metadata by document ID. Useful for retrieving HTML or Markdown content from table of contents items.",
|
|
123
157
|
inputSchema: GetDocumentArgsSchema,
|
|
124
|
-
|
|
158
|
+
outputSchema: DocumentOutputSchema,
|
|
159
|
+
handler: "getDocument",
|
|
160
|
+
...READ_ONLY
|
|
125
161
|
},
|
|
126
162
|
{
|
|
127
163
|
title: "Update Document",
|
|
128
164
|
toolset: "Documents",
|
|
129
165
|
summary: "Update the content or source of an existing document. Supports both HTML and Markdown content types.",
|
|
130
166
|
inputSchema: UpdateDocumentArgsSchema,
|
|
131
|
-
|
|
167
|
+
outputSchema: DocumentOutputSchema,
|
|
168
|
+
handler: "updateDocument",
|
|
169
|
+
...WRITE_DESTRUCTIVE
|
|
132
170
|
},
|
|
133
171
|
// Registry API tools for SwaggerHub Design functionality
|
|
134
172
|
{
|
|
@@ -136,21 +174,31 @@ const TOOLS = [
|
|
|
136
174
|
toolset: "Registry API",
|
|
137
175
|
summary: "Search for APIs and Domains in SwaggerHub Registry using the comprehensive /specs endpoint and retrieve metadata including owner, name, description, summary, version, and specification.",
|
|
138
176
|
inputSchema: ApiSearchParamsSchema,
|
|
139
|
-
|
|
177
|
+
outputSchema: SearchApisOutputSchema,
|
|
178
|
+
formatResponse: (result) => ({ items: result }),
|
|
179
|
+
handler: "searchApis",
|
|
180
|
+
...READ_ONLY
|
|
140
181
|
},
|
|
141
182
|
{
|
|
142
183
|
title: "Get API Definition",
|
|
143
184
|
toolset: "Registry API",
|
|
144
185
|
summary: "Fetch resolved API definition from SwaggerHub Registry based on owner, API name, and version.",
|
|
145
186
|
inputSchema: ApiDefinitionParamsSchema,
|
|
146
|
-
|
|
187
|
+
outputSchema: ApiDefinitionOutputSchema,
|
|
188
|
+
formatResponse: (result) => ({
|
|
189
|
+
definition: typeof result === "string" ? result : JSON.stringify(result, null, 2)
|
|
190
|
+
}),
|
|
191
|
+
handler: "getApiDefinition",
|
|
192
|
+
...READ_ONLY
|
|
147
193
|
},
|
|
148
194
|
{
|
|
149
195
|
title: "Create or Update API",
|
|
150
196
|
toolset: "Registry API",
|
|
151
197
|
summary: "Create a new API or update an existing API in SwaggerHub Registry for Swagger Studio. The API specification type (OpenAPI, AsyncAPI) is automatically detected from the definition content. APIs are always created with fixed values: version 1.0.0, private visibility, and automock disabled (these values cannot be changed). Returns HTTP 201 for creation, HTTP 200 for update. Response includes 'operation' field indicating whether it was a 'create' or 'update' operation along with API details and SwaggerHub URL.",
|
|
152
198
|
inputSchema: CreateApiParamsSchema,
|
|
153
|
-
|
|
199
|
+
outputSchema: CreateApiOutputSchema,
|
|
200
|
+
handler: "createOrUpdateApi",
|
|
201
|
+
...WRITE_DESTRUCTIVE
|
|
154
202
|
},
|
|
155
203
|
// User Management API tools for organization management functionality
|
|
156
204
|
{
|
|
@@ -158,35 +206,45 @@ const TOOLS = [
|
|
|
158
206
|
toolset: "Registry API",
|
|
159
207
|
summary: "Get organizations for a user. Returns a list of organizations that the authenticating user is a member of. On-Premise admin gets a list of all organizations in the system.",
|
|
160
208
|
inputSchema: OrganizationsQuerySchema,
|
|
161
|
-
|
|
209
|
+
outputSchema: OrganizationsListOutputSchema,
|
|
210
|
+
handler: "getOrganizations",
|
|
211
|
+
...READ_ONLY
|
|
162
212
|
},
|
|
163
213
|
{
|
|
164
214
|
title: "Scan API Standardization",
|
|
165
215
|
toolset: "Registry API",
|
|
166
216
|
summary: "Run a standardization scan against an API definition using the organization's governance and standardization rules. Accepts a raw YAML or JSON OpenAPI/AsyncAPI definition and returns a list of validation errors, the total issue count, and counts grouped by severity. Use this tool when the user provides the API definition content directly (as raw YAML or JSON) and asks to validate, scan, or check the governance or standardization of the API.",
|
|
167
217
|
inputSchema: ScanStandardizationParamsSchema,
|
|
168
|
-
|
|
218
|
+
outputSchema: ScanOutputSchema,
|
|
219
|
+
handler: "scanStandardization",
|
|
220
|
+
...READ_ONLY
|
|
169
221
|
},
|
|
170
222
|
{
|
|
171
223
|
title: "Scan API Standardization from Registry",
|
|
172
224
|
toolset: "Registry API",
|
|
173
225
|
summary: "Run a standardization scan on an API that already exists in SwaggerHub Registry, identified by organization name, API name, and version. Fetches the API definition from the registry internally and scans it against the organization's governance and standardization rules. Returns a list of validation errors, total issue count, counts grouped by severity, and a SwaggerHub UI URL for the scanned API. Use this tool when the user identifies the API by org name, API name, and version and asks to validate, scan, or check the governance or standardization of an existing API.",
|
|
174
226
|
inputSchema: ScanApiStandardizationFromRegistryParamsSchema,
|
|
175
|
-
|
|
227
|
+
outputSchema: ScanFromRegistryOutputSchema,
|
|
228
|
+
handler: "scanApiStandardizationFromRegistry",
|
|
229
|
+
...READ_ONLY
|
|
176
230
|
},
|
|
177
231
|
{
|
|
178
232
|
title: "Create API from Prompt",
|
|
179
233
|
toolset: "Registry API",
|
|
180
234
|
summary: "Generate and save an API definition based on a prompt using SmartBear AI. This tool automatically applies organization governance and standardization rules during API generation. The specType parameter determines the format of the generated definition. Use: 'openapi20' for OpenAPI 2.0, 'openapi30x' for OpenAPI 3.0.x, 'openapi31x' for OpenAPI 3.1.x, 'asyncapi2xx' for AsyncAPI 2.x, 'asyncapi30x' for AsyncAPI 3.0.x. Use this tool when creating APIs that comply with governance policies or when generating APIs from natural language descriptions. Use this tool when users ask to create, generate, or design APIs with governance or standardization requirements. Returns HTTP 201 for creation, HTTP 200 for update. Response includes 'operation' field indicating whether it was a 'create' or 'update' operation along with API details and SwaggerHub URL.",
|
|
181
235
|
inputSchema: CreateApiFromPromptParamsSchema,
|
|
182
|
-
|
|
236
|
+
outputSchema: CreateApiFromPromptOutputSchema,
|
|
237
|
+
handler: "createApiFromPrompt",
|
|
238
|
+
...WRITE_DESTRUCTIVE
|
|
183
239
|
},
|
|
184
240
|
{
|
|
185
241
|
title: "Standardize API",
|
|
186
242
|
toolset: "Registry API",
|
|
187
243
|
summary: "Standardize and fix an API definition using AI to ensure compliance with governance policies. Scans the API definition for standardization errors and automatically fixes them using SmartBear AI. Optionally provide 'newVersion' (e.g. patch bump '1.0.0' → '1.0.1') to save the fixed definition as a new version — omitting it will overwrite the current version. Returns the number of errors found and the fixed definition if successful. Use this tool when users ask to standardize, fix, govern, or ensure governance compliance of APIs.",
|
|
188
244
|
inputSchema: StandardizeApiParamsSchema,
|
|
189
|
-
|
|
245
|
+
outputSchema: StandardizeOutputSchema,
|
|
246
|
+
handler: "standardizeApi",
|
|
247
|
+
...WRITE_DESTRUCTIVE
|
|
190
248
|
},
|
|
191
249
|
...FUNCTIONAL_TESTING_TOOLS
|
|
192
250
|
];
|
|
@@ -8,6 +8,20 @@ const OrganizationsQuerySchema = z.object({
|
|
|
8
8
|
page: z.number().min(0).optional().describe("0-based index of the page to return"),
|
|
9
9
|
pageSize: z.number().min(1).max(1e3).optional().describe("Number of results per page to return")
|
|
10
10
|
});
|
|
11
|
+
const OrganizationsListOutputSchema = z.object({
|
|
12
|
+
totalCount: z.number().optional(),
|
|
13
|
+
pageSize: z.number().optional(),
|
|
14
|
+
page: z.number().optional(),
|
|
15
|
+
items: z.array(
|
|
16
|
+
z.looseObject({
|
|
17
|
+
id: z.string().optional(),
|
|
18
|
+
name: z.string().optional(),
|
|
19
|
+
email: z.string().optional(),
|
|
20
|
+
memberCount: z.number().optional()
|
|
21
|
+
})
|
|
22
|
+
).optional()
|
|
23
|
+
});
|
|
11
24
|
export {
|
|
25
|
+
OrganizationsListOutputSchema,
|
|
12
26
|
OrganizationsQuerySchema
|
|
13
27
|
};
|
package/dist/swagger/client.js
CHANGED
|
@@ -210,6 +210,9 @@ class SwaggerClient {
|
|
|
210
210
|
async listFunctionalTestingSuites() {
|
|
211
211
|
return this.withFunctionalTesting((ftApi) => ftApi.listSuites());
|
|
212
212
|
}
|
|
213
|
+
async getFunctionalTestingTestHistory(args) {
|
|
214
|
+
return this.withFunctionalTesting((ftApi) => ftApi.getTestHistory(args));
|
|
215
|
+
}
|
|
213
216
|
async registerTools(register, _getInput) {
|
|
214
217
|
TOOLS.forEach((tool) => {
|
|
215
218
|
if (tool.toolset === "Functional Testing" && !this.ftApi) {
|
|
@@ -228,8 +231,10 @@ class SwaggerClient {
|
|
|
228
231
|
const result = await handlerFn.call(this, args);
|
|
229
232
|
const formattedResult = formatResponse ? formatResponse(result) : result;
|
|
230
233
|
const responseText = typeof formattedResult === "string" ? formattedResult : JSON.stringify(formattedResult);
|
|
234
|
+
const isPlainObject = typeof formattedResult === "object" && formattedResult !== null && !Array.isArray(formattedResult);
|
|
231
235
|
return {
|
|
232
|
-
content: [{ type: "text", text: responseText }]
|
|
236
|
+
content: [{ type: "text", text: responseText }],
|
|
237
|
+
...isPlainObject && { structuredContent: formattedResult }
|
|
233
238
|
};
|
|
234
239
|
} catch (error) {
|
|
235
240
|
return {
|
|
@@ -238,7 +243,8 @@ class SwaggerClient {
|
|
|
238
243
|
type: "text",
|
|
239
244
|
text: `Error: ${error instanceof Error ? error.message : String(error)}`
|
|
240
245
|
}
|
|
241
|
-
]
|
|
246
|
+
],
|
|
247
|
+
isError: true
|
|
242
248
|
};
|
|
243
249
|
}
|
|
244
250
|
});
|
package/package.json
CHANGED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { Tool, ToolError } from "../../../common/tools.js";
|
|
3
|
-
const inputSchema = z.object({});
|
|
4
|
-
class RefineAllDraftTests extends Tool {
|
|
5
|
-
specification = {
|
|
6
|
-
title: "Refine All Draft Tests",
|
|
7
|
-
toolset: "Tasks",
|
|
8
|
-
summary: "Refines every draft test case in the workspace. Use to push an entire draft backlog forward; may take multiple passes before all drafts are ready to be promoted to regression tests.",
|
|
9
|
-
inputSchema
|
|
10
|
-
};
|
|
11
|
-
handle = async (_args) => {
|
|
12
|
-
const res = await fetch(`${this.client.getBaseUrl()}/tasks`, {
|
|
13
|
-
method: "POST",
|
|
14
|
-
headers: this.client.getHeaders(),
|
|
15
|
-
body: JSON.stringify({ agent: "tester", mode: "refine" })
|
|
16
|
-
});
|
|
17
|
-
if (!res.ok)
|
|
18
|
-
throw new ToolError(
|
|
19
|
-
`POST /tasks failed: ${res.status} ${res.statusText}`
|
|
20
|
-
);
|
|
21
|
-
return {
|
|
22
|
-
content: [{ type: "text", text: JSON.stringify(await res.json()) }]
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
RefineAllDraftTests
|
|
28
|
-
};
|