@smartbear/mcp 0.12.0 → 0.13.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.
Files changed (89) hide show
  1. package/README.md +30 -6
  2. package/dist/bugsnag/client/api/CurrentUser.js +50 -26
  3. package/dist/bugsnag/client/api/Error.js +158 -57
  4. package/dist/bugsnag/client/api/Project.js +398 -243
  5. package/dist/bugsnag/client/api/api.js +4087 -3837
  6. package/dist/bugsnag/client/api/base.js +155 -173
  7. package/dist/bugsnag/client/api/configuration.js +28 -25
  8. package/dist/bugsnag/client/filters.js +11 -20
  9. package/dist/bugsnag/client.js +1398 -1277
  10. package/dist/bugsnag/input-schemas.js +39 -57
  11. package/dist/collaborator/client.js +335 -371
  12. package/dist/common/bugsnag.js +5 -3
  13. package/dist/common/cache.js +50 -57
  14. package/dist/common/client-registry.js +106 -119
  15. package/dist/common/info.js +7 -3
  16. package/dist/common/register-clients.js +0 -16
  17. package/dist/common/server.js +270 -228
  18. package/dist/common/tools.js +19 -0
  19. package/dist/common/transport-http.js +252 -343
  20. package/dist/common/transport-stdio.js +40 -37
  21. package/dist/common/zod-utils.js +20 -0
  22. package/dist/index.js +18 -23
  23. package/dist/package.json.js +11 -0
  24. package/dist/pactflow/client/ai.js +142 -169
  25. package/dist/pactflow/client/base.js +41 -51
  26. package/dist/pactflow/client/prompt-utils.js +93 -84
  27. package/dist/pactflow/client/prompts.js +95 -92
  28. package/dist/pactflow/client/tools.js +94 -83
  29. package/dist/pactflow/client/utils.js +60 -64
  30. package/dist/pactflow/client.js +399 -320
  31. package/dist/qmetry/client/api/client-api.js +43 -41
  32. package/dist/qmetry/client/api/error-handler.js +264 -310
  33. package/dist/qmetry/client/auto-resolve.js +78 -99
  34. package/dist/qmetry/client/automation.js +139 -162
  35. package/dist/qmetry/client/handlers.js +49 -46
  36. package/dist/qmetry/client/issues.js +133 -115
  37. package/dist/qmetry/client/project.js +153 -174
  38. package/dist/qmetry/client/requirement.js +82 -70
  39. package/dist/qmetry/client/testcase.js +240 -208
  40. package/dist/qmetry/client/testsuite.js +332 -293
  41. package/dist/qmetry/client/tools/automation-tools.js +291 -288
  42. package/dist/qmetry/client/tools/index.js +16 -13
  43. package/dist/qmetry/client/tools/issue-tools.js +534 -543
  44. package/dist/qmetry/client/tools/project-tools.js +635 -656
  45. package/dist/qmetry/client/tools/requirement-tools.js +525 -528
  46. package/dist/qmetry/client/tools/testcase-tools.js +773 -786
  47. package/dist/qmetry/client/tools/testsuite-tools.js +1069 -1083
  48. package/dist/qmetry/client/utils.js +8 -14
  49. package/dist/qmetry/client.js +111 -109
  50. package/dist/qmetry/config/constants.js +48 -44
  51. package/dist/qmetry/config/rest-endpoints.js +51 -48
  52. package/dist/qmetry/types/automation.js +7 -7
  53. package/dist/qmetry/types/common.js +763 -1049
  54. package/dist/qmetry/types/issues.js +26 -19
  55. package/dist/qmetry/types/project.js +32 -25
  56. package/dist/qmetry/types/requirements.js +26 -21
  57. package/dist/qmetry/types/testcase.js +55 -44
  58. package/dist/qmetry/types/testsuite.js +66 -52
  59. package/dist/reflect/client.js +284 -226
  60. package/dist/swagger/client/api.js +645 -662
  61. package/dist/swagger/client/configuration.js +31 -33
  62. package/dist/swagger/client/portal-types.js +204 -244
  63. package/dist/swagger/client/registry-types.js +62 -96
  64. package/dist/swagger/client/tools.js +148 -158
  65. package/dist/swagger/client/user-management-types.js +11 -22
  66. package/dist/swagger/client.js +143 -135
  67. package/dist/swagger/config-utils.js +10 -16
  68. package/dist/zephyr/client.js +43 -42
  69. package/dist/zephyr/common/api-client.js +35 -30
  70. package/dist/zephyr/common/auth-service.js +16 -13
  71. package/dist/zephyr/common/rest-api-schemas.js +3173 -5146
  72. package/dist/zephyr/tool/environment/get-environments.js +66 -66
  73. package/dist/zephyr/tool/priority/get-priorities.js +41 -41
  74. package/dist/zephyr/tool/project/get-project.js +37 -37
  75. package/dist/zephyr/tool/project/get-projects.js +46 -46
  76. package/dist/zephyr/tool/status/get-statuses.js +47 -47
  77. package/dist/zephyr/tool/test-case/get-test-case.js +37 -37
  78. package/dist/zephyr/tool/test-case/get-test-cases.js +62 -62
  79. package/dist/zephyr/tool/test-cycle/get-test-cycle.js +37 -37
  80. package/dist/zephyr/tool/test-cycle/get-test-cycles.js +70 -70
  81. package/dist/zephyr/tool/test-execution/get-test-execution.js +37 -37
  82. package/dist/zephyr/tool/test-execution/get-test-executions.js +43 -43
  83. package/package.json +5 -5
  84. package/dist/bugsnag/client/api/index.js +0 -6
  85. package/dist/common/types.js +0 -6
  86. package/dist/qmetry/client/tools/types.js +0 -1
  87. package/dist/swagger/client/index.js +0 -6
  88. package/dist/tests/unit/bugsnag/utils/factories.js +0 -86
  89. package/dist/zephyr/tool/zephyr-tool.js +0 -1
@@ -2,47 +2,50 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
2
2
  import { clientRegistry } from "./client-registry.js";
3
3
  import { MCP_SERVER_NAME, MCP_SERVER_VERSION } from "./info.js";
4
4
  import { SmartBearMcpServer } from "./server.js";
5
- /**
6
- * Generate a dynamic error message listing all available clients and their required env vars
7
- */
8
- function getNoConfigErrorMessage() {
9
- const messages = [];
10
- for (const entry of clientRegistry.getAll()) {
11
- messages.push(` - ${entry.name}:`);
12
- for (const [configKey, requirement] of Object.entries(entry.config.shape)) {
13
- const envVarName = getEnvVarName(entry, configKey);
14
- const requiredTag = requirement.isOptional()
15
- ? " (optional)"
16
- : " (required)";
17
- messages.push(` - ${envVarName}${requiredTag}: ${requirement.description}`);
18
- }
5
+ import { isOptionalType } from "./zod-utils.js";
6
+ function getNoConfigMessage() {
7
+ const messages = [];
8
+ for (const entry of clientRegistry.getAll()) {
9
+ messages.push(` - ${entry.name}:`);
10
+ for (const [configKey, requirement] of Object.entries(entry.config.shape)) {
11
+ const envVarName = getEnvVarName(entry, configKey);
12
+ const requiredTag = isOptionalType(requirement) ? " (optional)" : " (required)";
13
+ messages.push(
14
+ ` - ${envVarName}${requiredTag}: ${requirement.description}`
15
+ );
19
16
  }
20
- return messages;
17
+ }
18
+ return messages;
21
19
  }
22
- /**
23
- * Run server in STDIO mode (default)
24
- */
25
- export async function runStdioMode() {
26
- if (process.argv.includes("--version")) {
27
- console.log(`${MCP_SERVER_NAME}: v${MCP_SERVER_VERSION}`);
28
- process.exit(0);
20
+ async function runStdioMode() {
21
+ if (process.argv.includes("--version")) {
22
+ console.log(`${MCP_SERVER_NAME}: v${MCP_SERVER_VERSION}`);
23
+ process.exit(0);
24
+ }
25
+ const server = new SmartBearMcpServer();
26
+ const configuredCount = await clientRegistry.configure(
27
+ server,
28
+ (client, key) => {
29
+ const envVarName = getEnvVarName(client, key);
30
+ return process.env[envVarName] || null;
29
31
  }
30
- const server = new SmartBearMcpServer();
31
- // Setup clients from environment variables
32
- const configuredCount = await clientRegistry.configure(server, (client, key) => {
33
- const envVarName = getEnvVarName(client, key);
34
- return process.env[envVarName] || null;
35
- });
36
- if (configuredCount === 0) {
37
- const errorMessage = getNoConfigErrorMessage();
38
- console.error(errorMessage.length > 0
39
- ? `No clients configured. Please provide valid environment variables for at least one client:\n${errorMessage.join("\n")}`
40
- : "No clients support environment variable configuration.");
41
- process.exit(1);
32
+ );
33
+ if (configuredCount === 0) {
34
+ const message = getNoConfigMessage();
35
+ console.warn(
36
+ message.length > 0 ? `No clients configured. Please provide valid environment variables for at least one client:
37
+ ${message.join("\n")}` : "No clients support environment variable configuration."
38
+ );
39
+ for (const entry of clientRegistry.getAll()) {
40
+ await server.addClient(entry);
42
41
  }
43
- const transport = new StdioServerTransport();
44
- await server.connect(transport);
42
+ }
43
+ const transport = new StdioServerTransport();
44
+ await server.connect(transport);
45
45
  }
46
46
  function getEnvVarName(client, key) {
47
- return `${client.configPrefix.toUpperCase().replace(/-/g, "_")}_${key.toUpperCase()}`;
47
+ return `${client.configPrefix.toUpperCase().replace(/-/g, "_")}_${key.toUpperCase()}`;
48
48
  }
49
+ export {
50
+ runStdioMode
51
+ };
@@ -0,0 +1,20 @@
1
+ import { ZodOptional, ZodDefault, ZodNullable } from "zod";
2
+ function isOptionalType(zodType) {
3
+ return zodType instanceof ZodOptional || zodType instanceof ZodDefault || zodType instanceof ZodNullable;
4
+ }
5
+ function unwrapZodType(zodType) {
6
+ if (zodType instanceof ZodOptional) {
7
+ return unwrapZodType(zodType.unwrap());
8
+ }
9
+ if (zodType instanceof ZodDefault) {
10
+ return unwrapZodType(zodType.unwrap());
11
+ }
12
+ if (zodType instanceof ZodNullable) {
13
+ return unwrapZodType(zodType.unwrap());
14
+ }
15
+ return zodType;
16
+ }
17
+ export {
18
+ isOptionalType,
19
+ unwrapZodType
20
+ };
package/dist/index.js CHANGED
@@ -1,34 +1,29 @@
1
1
  #!/usr/bin/env node
2
2
  import Bugsnag from "./common/bugsnag.js";
3
- import "./common/register-clients.js"; // Register all available clients
3
+ import "./common/register-clients.js";
4
4
  import { runHttpMode } from "./common/transport-http.js";
5
5
  import { runStdioMode } from "./common/transport-stdio.js";
6
- // This is used to report errors in the MCP server itself
7
- // If you want to use your own BugSnag API key, set the MCP_SERVER_BUGSNAG_API_KEY environment variable
8
6
  const McpServerBugsnagAPIKey = process.env.MCP_SERVER_BUGSNAG_API_KEY;
9
7
  if (McpServerBugsnagAPIKey) {
10
- Bugsnag.start(McpServerBugsnagAPIKey);
8
+ Bugsnag.start(McpServerBugsnagAPIKey);
11
9
  }
12
10
  async function main() {
13
- // Determine transport mode from environment variable
14
- // MCP_TRANSPORT can be "stdio" (default) or "http"
15
- const transportMode = process.env.MCP_TRANSPORT?.toLowerCase() || "stdio";
16
- if (transportMode === "http") {
17
- console.log("[MCP] Starting in HTTP mode...");
18
- await runHttpMode();
19
- }
20
- else if (transportMode === "stdio") {
21
- await runStdioMode();
22
- }
23
- else {
24
- console.error(`[MCP] Invalid transport mode: ${transportMode}. Use "stdio" or "http".`);
25
- process.exit(1);
26
- }
11
+ const transportMode = process.env.MCP_TRANSPORT?.toLowerCase() || "stdio";
12
+ if (transportMode === "http") {
13
+ console.log("[MCP] Starting in HTTP mode...");
14
+ await runHttpMode();
15
+ } else if (transportMode === "stdio") {
16
+ await runStdioMode();
17
+ } else {
18
+ console.error(
19
+ `[MCP] Invalid transport mode: ${transportMode}. Use "stdio" or "http".`
20
+ );
21
+ process.exit(1);
22
+ }
27
23
  }
28
24
  try {
29
- await main();
30
- }
31
- catch (error) {
32
- console.error("Fatal error in main():", error);
33
- process.exit(1);
25
+ await main();
26
+ } catch (error) {
27
+ console.error("Fatal error in main():", error);
28
+ process.exit(1);
34
29
  }
@@ -0,0 +1,11 @@
1
+ const version = "0.13.1";
2
+ const config = { "mcpServerName": "SmartBear MCP Server" };
3
+ const packageJson = {
4
+ version,
5
+ config
6
+ };
7
+ export {
8
+ config,
9
+ packageJson as default,
10
+ version
11
+ };
@@ -1,177 +1,150 @@
1
1
  import { z } from "zod";
2
2
  import { addOpenAPISpecToSchema } from "./utils.js";
3
- // Type definitions for PactFlow AI API
4
- export const GenerationLanguages = [
5
- "javascript",
6
- "typescript",
7
- "java",
8
- "golang",
9
- "dotnet",
10
- "kotlin",
11
- "swift",
12
- "php",
3
+ const GenerationLanguages = [
4
+ "javascript",
5
+ "typescript",
6
+ "java",
7
+ "golang",
8
+ "dotnet",
9
+ "kotlin",
10
+ "swift",
11
+ "php"
13
12
  ];
14
- export const HttpMethods = [
15
- "GET",
16
- "PUT",
17
- "POST",
18
- "DELETE",
19
- "OPTIONS",
20
- "HEAD",
21
- "PATCH",
22
- "TRACE",
13
+ const HttpMethods = [
14
+ "GET",
15
+ "PUT",
16
+ "POST",
17
+ "DELETE",
18
+ "OPTIONS",
19
+ "HEAD",
20
+ "PATCH",
21
+ "TRACE"
23
22
  ];
24
- // zod schemas
25
- export const FileInputSchema = z.object({
26
- filename: z
27
- .string()
28
- .optional()
29
- .describe("Filename (helps identify file type and context)"),
30
- language: z
31
- .string()
32
- .optional()
33
- .describe("Programming language (e.g., 'javascript', 'java', 'python') for better analysis"),
34
- body: z
35
- .string()
36
- .describe("Complete file contents - client code, models, test files, etc."),
23
+ const FileInputSchema = z.object({
24
+ filename: z.string().optional().describe("Filename (helps identify file type and context)"),
25
+ language: z.string().optional().describe(
26
+ "Programming language (e.g., 'javascript', 'java', 'python') for better analysis"
27
+ ),
28
+ body: z.string().describe("Complete file contents - client code, models, test files, etc.")
37
29
  });
38
- export const OpenAPISchema = z
39
- .object({
40
- openapi: z
41
- .string()
42
- .optional()
43
- .describe("For OpenAPI version (e.g., '3.0.0')"),
44
- swagger: z
45
- .string()
46
- .describe("For OpenAPI documents version 2.x (e.g., '2.0')")
47
- .optional(),
48
- paths: z
49
- .record(z.string(), z.record(z.string(), z.any()))
50
- .describe("OpenAPI paths object containing all API endpoints"),
51
- components: z
52
- .record(z.string(), z.record(z.string(), z.any()))
53
- .optional()
54
- .describe("OpenAPI components section (schemas, responses, etc.)"),
55
- })
56
- .passthrough()
57
- .describe("The complete OpenAPI document describing the API.")
58
- .refine((data) => data.openapi || data.swagger, {
59
- message: "Either 'openapi' (for v3+) or 'swagger' (for v2) must be provided",
60
- path: ["openapi"],
30
+ const OpenAPISchema = z.object({
31
+ openapi: z.string().optional().describe("For OpenAPI version (e.g., '3.0.0')"),
32
+ swagger: z.string().describe("For OpenAPI documents version 2.x (e.g., '2.0')").optional(),
33
+ paths: z.record(z.string(), z.record(z.string(), z.any())).describe("OpenAPI paths object containing all API endpoints"),
34
+ components: z.record(z.string(), z.record(z.string(), z.any())).optional().describe("OpenAPI components section (schemas, responses, etc.)")
35
+ }).passthrough().describe("The complete OpenAPI document describing the API.").refine((data) => data.openapi || data.swagger, {
36
+ message: "Either 'openapi' (for v3+) or 'swagger' (for v2) must be provided",
37
+ path: ["openapi"]
61
38
  });
62
- export const EndpointMatcherSchema = z
63
- .object({
64
- path: z
65
- .string()
66
- .optional()
67
- .describe("Path pattern to match specific endpoints (e.g., '/users/{id}', '/users/*', '/users/**'). Supports glob patterns: ? (single char), * (excluding /), ** (including /)"),
68
- methods: z
69
- .array(z.enum(HttpMethods))
70
- .optional()
71
- .describe("HTTP methods to include (e.g., ['GET', 'POST']). If not specified, all methods are matched"),
72
- statusCodes: z
73
- .array(z.union([z.number(), z.string()]))
74
- .optional()
75
- .describe("Response status codes to include (e.g., [200, '2XX', 404]). Use 'X' as wildcard (e.g., '2XX' for 200-299). Defaults to successful codes (2XX)"),
76
- operationId: z
77
- .string()
78
- .optional()
79
- .describe("OpenAPI operation ID to match (e.g., 'getUserById', 'get*'). Supports glob patterns"),
80
- })
81
- .optional()
82
- .describe("REQUIRED: Matcher to specify which endpoints from the OpenAPI document to generate tests for. At least one matcher field must be provided");
83
- export const RemoteOpenAPIDocumentSchema = z
84
- .object({
85
- authToken: z
86
- .string()
87
- .describe("Auth Bearer Token if the OpenAPI spec requires authentication.")
88
- .optional(),
89
- authScheme: z
90
- .string()
91
- .describe("Authentication scheme (e.g., 'Bearer', 'Basic'). Default scheme passed should be Bearer if authToken is specified and this field is not set.")
92
- .default("Bearer")
93
- .optional(),
94
- url: z
95
- .string()
96
- .url("Must be a valid openapi url")
97
- .describe("URL of the remote OpenAPI document.")
98
- .optional(),
99
- })
100
- .describe("Use this schema to fetch openapi documents present over a url.");
101
- export const OpenAPIWithMatcherSchema = z
102
- .object({
103
- document: OpenAPISchema.describe("The OpenAPI document describing the API being tested. if document is not provided, don't add the field if remoteOpenAPIDocument is provided.").optional(),
104
- matcher: EndpointMatcherSchema,
105
- remoteDocument: RemoteOpenAPIDocumentSchema.optional().describe("The remote OpenAPI document to use for the review/generation in case openapi document is not provided. If provided do not include the document field under openapi."),
106
- })
107
- .describe("If provided, the OpenAPI document which describes the API being tested and is accompanied by a matcher which will be used to identify the interactions in the OpenAPI document which are relevant to the Pact refinement process.")
108
- .transform(addOpenAPISpecToSchema);
109
- export const RefineInputSchema = z.object({
110
- pactTests: FileInputSchema.describe("Primary pact tests that needs to be refined."),
111
- code: z
112
- .array(FileInputSchema)
113
- .describe("Collection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls")
114
- .optional(),
115
- userInstructions: z
116
- .string()
117
- .describe("Optional free-form instructions that provide additional context or specify areas of focus during the refinement process of the Pact test.")
118
- .optional(),
119
- errorMessages: z
120
- .array(z.string())
121
- .describe("Optional error output from failed contract test runs. These can be used to better understand the context or failures observed and guide the recommendations toward resolving specific issues.")
122
- .optional(),
123
- openapi: OpenAPIWithMatcherSchema.optional(),
39
+ const EndpointMatcherSchema = z.object({
40
+ path: z.string().optional().describe(
41
+ "Path pattern to match specific endpoints (e.g., '/users/{id}', '/users/*', '/users/**'). Supports glob patterns: ? (single char), * (excluding /), ** (including /)"
42
+ ),
43
+ methods: z.array(z.enum(HttpMethods)).optional().describe(
44
+ "HTTP methods to include (e.g., ['GET', 'POST']). If not specified, all methods are matched"
45
+ ),
46
+ statusCodes: z.array(z.union([z.number(), z.string()])).optional().describe(
47
+ "Response status codes to include (e.g., [200, '2XX', 404]). Use 'X' as wildcard (e.g., '2XX' for 200-299). Defaults to successful codes (2XX)"
48
+ ),
49
+ operationId: z.string().optional().describe(
50
+ "OpenAPI operation ID to match (e.g., 'getUserById', 'get*'). Supports glob patterns"
51
+ )
52
+ }).optional().describe(
53
+ "REQUIRED: Matcher to specify which endpoints from the OpenAPI document to generate tests for. At least one matcher field must be provided"
54
+ );
55
+ const RemoteOpenAPIDocumentSchema = z.object({
56
+ authToken: z.string().describe(
57
+ "Auth Bearer Token if the OpenAPI spec requires authentication."
58
+ ).optional(),
59
+ authScheme: z.string().describe(
60
+ "Authentication scheme (e.g., 'Bearer', 'Basic'). Default scheme passed should be Bearer if authToken is specified and this field is not set."
61
+ ).default("Bearer").optional(),
62
+ url: z.string().url("Must be a valid openapi url").describe("URL of the remote OpenAPI document.").optional()
63
+ }).describe("Use this schema to fetch openapi documents present over a url.");
64
+ const OpenAPIWithMatcherSchema = z.object({
65
+ document: OpenAPISchema.describe(
66
+ "The OpenAPI document describing the API being tested. if document is not provided, don't add the field if remoteOpenAPIDocument is provided."
67
+ ).optional(),
68
+ matcher: EndpointMatcherSchema,
69
+ remoteDocument: RemoteOpenAPIDocumentSchema.optional().describe(
70
+ "The remote OpenAPI document to use for the review/generation in case openapi document is not provided. If provided do not include the document field under openapi."
71
+ )
72
+ }).describe(
73
+ "If provided, the OpenAPI document which describes the API being tested and is accompanied by a matcher which will be used to identify the interactions in the OpenAPI document which are relevant to the Pact refinement process."
74
+ ).transform(addOpenAPISpecToSchema);
75
+ const RefineInputSchema = z.object({
76
+ pactTests: FileInputSchema.describe(
77
+ "Primary pact tests that needs to be refined."
78
+ ),
79
+ code: z.array(FileInputSchema).describe(
80
+ "Collection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls"
81
+ ).optional(),
82
+ userInstructions: z.string().describe(
83
+ "Optional free-form instructions that provide additional context or specify areas of focus during the refinement process of the Pact test."
84
+ ).optional(),
85
+ errorMessages: z.array(z.string()).describe(
86
+ "Optional error output from failed contract test runs. These can be used to better understand the context or failures observed and guide the recommendations toward resolving specific issues."
87
+ ).optional(),
88
+ openapi: OpenAPIWithMatcherSchema.optional()
124
89
  });
125
- export const RequestResponsePairSchema = z
126
- .object({
127
- request: FileInputSchema,
128
- response: FileInputSchema,
129
- })
130
- .describe("Direct request/response pair for a specific interaction. Use this when you have concrete examples of API requests and responses");
131
- export const GenerationInputSchema = z.object({
132
- language: z
133
- .enum(GenerationLanguages)
134
- .optional()
135
- .describe("Target language for the generated Pact tests. If not provided, will be inferred from other inputs."),
136
- requestResponse: RequestResponsePairSchema.optional(),
137
- code: z
138
- .array(FileInputSchema)
139
- .optional()
140
- .describe("Collection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls"),
141
- openapi: OpenAPIWithMatcherSchema.optional(),
142
- additionalInstructions: z
143
- .string()
144
- .optional()
145
- .describe("Optional free-form instructions to guide the generation process (e.g., 'Focus on error scenarios', 'Include authentication headers', 'Use specific test framework patterns')"),
146
- testTemplate: FileInputSchema.optional().describe("Optional test template to use as a basis for generation. Helps ensure generated tests follow your specific patterns, frameworks, and coding standards"),
90
+ const RequestResponsePairSchema = z.object({
91
+ request: FileInputSchema,
92
+ response: FileInputSchema
93
+ }).describe(
94
+ "Direct request/response pair for a specific interaction. Use this when you have concrete examples of API requests and responses"
95
+ );
96
+ const GenerationInputSchema = z.object({
97
+ language: z.enum(GenerationLanguages).optional().describe(
98
+ "Target language for the generated Pact tests. If not provided, will be inferred from other inputs."
99
+ ),
100
+ requestResponse: RequestResponsePairSchema.optional(),
101
+ code: z.array(FileInputSchema).optional().describe(
102
+ "Collection of source code files to analyze and extract API interactions from. Include client code, data models, existing tests, or any code that makes API calls"
103
+ ),
104
+ openapi: OpenAPIWithMatcherSchema.optional(),
105
+ additionalInstructions: z.string().optional().describe(
106
+ "Optional free-form instructions to guide the generation process (e.g., 'Focus on error scenarios', 'Include authentication headers', 'Use specific test framework patterns')"
107
+ ),
108
+ testTemplate: FileInputSchema.optional().describe(
109
+ "Optional test template to use as a basis for generation. Helps ensure generated tests follow your specific patterns, frameworks, and coding standards"
110
+ )
147
111
  });
148
- export const MatcherRecommendationInputSchema = z.array(EndpointMatcherSchema);
149
- export const AiCreditsSchema = z
150
- .object({
151
- total: z.number().describe("The total number of AI credits available."),
152
- used: z.number().describe("The number of AI credits used."),
153
- })
154
- .describe("AI credits information.");
155
- export const OrganizationEntitlementsSchema = z
156
- .object({
157
- name: z.string().describe("The name of the organization."),
158
- planAiEnabled: z
159
- .boolean()
160
- .describe("Whether AI features are enabled at the plan level."),
161
- preferencesAiEnabled: z
162
- .boolean()
163
- .describe("Whether AI features are enabled at the preferences level."),
164
- aiCredits: AiCreditsSchema.describe("AI credits information."),
165
- })
166
- .describe("Organization entitlements information.");
167
- export const UserEntitlementsSchema = z
168
- .object({
169
- aiPermissions: z.array(z.string()).describe("List of AI permissions."),
170
- })
171
- .describe("User entitlements information.");
172
- export const EntitlementsSchema = z
173
- .object({
174
- organizationEntitlements: OrganizationEntitlementsSchema.describe("Organization entitlements information."),
175
- userEntitlements: UserEntitlementsSchema.describe("User entitlements information."),
176
- })
177
- .describe("Entitlements information.");
112
+ const MatcherRecommendationInputSchema = z.array(EndpointMatcherSchema);
113
+ const AiCreditsSchema = z.object({
114
+ total: z.number().describe("The total number of AI credits available."),
115
+ used: z.number().describe("The number of AI credits used.")
116
+ }).describe("AI credits information.");
117
+ const OrganizationEntitlementsSchema = z.object({
118
+ name: z.string().describe("The name of the organization."),
119
+ planAiEnabled: z.boolean().describe("Whether AI features are enabled at the plan level."),
120
+ preferencesAiEnabled: z.boolean().describe("Whether AI features are enabled at the preferences level."),
121
+ aiCredits: AiCreditsSchema.describe("AI credits information.")
122
+ }).describe("Organization entitlements information.");
123
+ const UserEntitlementsSchema = z.object({
124
+ aiPermissions: z.array(z.string()).describe("List of AI permissions.")
125
+ }).describe("User entitlements information.");
126
+ z.object({
127
+ organizationEntitlements: OrganizationEntitlementsSchema.describe(
128
+ "Organization entitlements information."
129
+ ),
130
+ userEntitlements: UserEntitlementsSchema.describe(
131
+ "User entitlements information."
132
+ ),
133
+ aiEnabled: z.boolean()
134
+ }).describe("Entitlements information.");
135
+ export {
136
+ AiCreditsSchema,
137
+ EndpointMatcherSchema,
138
+ FileInputSchema,
139
+ GenerationInputSchema,
140
+ GenerationLanguages,
141
+ HttpMethods,
142
+ MatcherRecommendationInputSchema,
143
+ OpenAPISchema,
144
+ OpenAPIWithMatcherSchema,
145
+ OrganizationEntitlementsSchema,
146
+ RefineInputSchema,
147
+ RemoteOpenAPIDocumentSchema,
148
+ RequestResponsePairSchema,
149
+ UserEntitlementsSchema
150
+ };
@@ -1,54 +1,44 @@
1
1
  import { z } from "zod";
2
- export const CanIDeploySchema = z.object({
3
- pacticipant: z
4
- .string()
5
- .describe("The name of the pacticipant (application/service) being evaluated for deployment"),
6
- version: z
7
- .string()
8
- .describe("The version of the pacticipant that you want to check if it's safe to deploy"),
9
- environment: z
10
- .string()
11
- .describe("The target environment where the pacticipant version will be deployed (e.g., 'production', 'staging', 'test')"),
2
+ const CanIDeploySchema = z.object({
3
+ pacticipant: z.string().describe(
4
+ "The name of the pacticipant (application/service) being evaluated for deployment"
5
+ ),
6
+ version: z.string().describe(
7
+ "The version of the pacticipant that you want to check if it's safe to deploy"
8
+ ),
9
+ environment: z.string().describe(
10
+ "The target environment where the pacticipant version will be deployed (e.g., 'production', 'staging', 'test')"
11
+ )
12
12
  });
13
- export const MatrixSchema = z.object({
14
- latestby: z
15
- .string()
16
- .optional()
17
- .describe("This property removes the rows for the overridden pacts/verifications from the results. The options are cvp (show only the latest row for each consumer version and provider) and cvpv (show only the latest row each consumer version and provider version). For a can-i-deploy query with one selector, it should be set to cvp. For a can-i-deploy query with two selectors, it should be set to cvpv."),
18
- limit: z
19
- .number()
20
- .min(1)
21
- .max(1000)
22
- .default(100)
23
- .optional()
24
- .describe("The limit on the number of results to return (1-1000, default: 100)"),
25
- q: z
26
- .array(z.object({
27
- pacticipant: z
28
- .string()
29
- .describe("Name of the pacticipant (application)"),
30
- version: z.string().optional().describe("Version number"),
31
- branch: z
32
- .string()
33
- .optional()
34
- .describe("Name of the pacticipant version branch"),
35
- environment: z
36
- .string()
37
- .optional()
38
- .describe("The name of the environment that the pacticipant version is deployed to"),
39
- latest: z
40
- .boolean()
41
- .optional()
42
- .describe("Used in conjunction with other properties to indicate whether the selector is describing the latest version from a branch/with a tag/for a pacticipant, or all of them. Note that when used with tags, the 'latest' is calculated using the creation date of the pacticipant version, NOT the creation date of the tag."),
43
- tag: z
44
- .string()
45
- .optional()
46
- .describe("The name of the pacticipant version tag (superseded by branch and environments)"),
47
- mainBranch: z
48
- .boolean()
49
- .optional()
50
- .describe("Whether or not the version(s) described are from the main branch of the pacticipant, as set in the mainBranch property of the pacticipant resource."),
51
- }))
52
- .min(1)
53
- .max(2),
13
+ const MatrixSchema = z.object({
14
+ latestby: z.string().optional().describe(
15
+ "This property removes the rows for the overridden pacts/verifications from the results. The options are cvp (show only the latest row for each consumer version and provider) and cvpv (show only the latest row each consumer version and provider version). For a can-i-deploy query with one selector, it should be set to cvp. For a can-i-deploy query with two selectors, it should be set to cvpv."
16
+ ),
17
+ limit: z.number().min(1).max(1e3).default(100).optional().describe(
18
+ "The limit on the number of results to return (1-1000, default: 100)"
19
+ ),
20
+ q: z.array(
21
+ z.object({
22
+ pacticipant: z.string().describe("Name of the pacticipant (application)"),
23
+ version: z.string().optional().describe("Version number"),
24
+ branch: z.string().optional().describe("Name of the pacticipant version branch"),
25
+ environment: z.string().optional().describe(
26
+ "The name of the environment that the pacticipant version is deployed to"
27
+ ),
28
+ latest: z.boolean().optional().describe(
29
+ "Used in conjunction with other properties to indicate whether the selector is describing the latest version from a branch/with a tag/for a pacticipant, or all of them. Note that when used with tags, the 'latest' is calculated using the creation date of the pacticipant version, NOT the creation date of the tag."
30
+ ),
31
+ tag: z.string().optional().describe(
32
+ "The name of the pacticipant version tag (superseded by branch and environments)"
33
+ ),
34
+ mainBranch: z.boolean().optional().describe(
35
+ "Whether or not the version(s) described are from the main branch of the pacticipant, as set in the mainBranch property of the pacticipant resource."
36
+ )
37
+ })
38
+ ).min(1).max(2)
54
39
  });
40
+ z.object({});
41
+ export {
42
+ CanIDeploySchema,
43
+ MatrixSchema
44
+ };