@skyramp/mcp 0.0.6 → 0.0.7
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 +4 -5
- package/build/index.js +0 -2
- package/build/prompts/startTraceCollectionPrompts.js +5 -26
- package/build/prompts/testGenerationPrompt.js +94 -347
- package/build/tools/executeSkyrampTestTool.js +1 -1
- package/build/tools/generateIntegrationRestTool.js +1 -0
- package/build/tools/generateLoadRestTool.js +4 -0
- package/build/tools/startTraceCollectionTool.js +5 -20
- package/build/tools/stopTraceCollectionTool.js +0 -15
- package/build/types/TestTypes.js +1 -1
- package/package.json +1 -1
- package/build/prompts/stopTraceCollectionPrompts.js +0 -113
package/README.md
CHANGED
|
@@ -143,11 +143,10 @@ This MCP server provides the following tools:
|
|
|
143
143
|
|
|
144
144
|
This MCP server provides the following prompts:
|
|
145
145
|
|
|
146
|
-
| Prompt Name
|
|
147
|
-
|
|
|
148
|
-
| skyramp_test_generation_prompt
|
|
149
|
-
| skyramp_trace_prompt
|
|
150
|
-
| skyramp_stop_trace_collection_prompt | Guidance for stopping trace collection |
|
|
146
|
+
| Prompt Name | Description |
|
|
147
|
+
| ------------------------------ | -------------------------------------- |
|
|
148
|
+
| skyramp_test_generation_prompt | Guidance for generating Skyramp tests |
|
|
149
|
+
| skyramp_trace_prompt | Guidance for starting trace collection |
|
|
151
150
|
|
|
152
151
|
## How it Works
|
|
153
152
|
|
package/build/index.js
CHANGED
|
@@ -5,7 +5,6 @@ import { registerStartTraceCollectionPrompt } from "./prompts/startTraceCollecti
|
|
|
5
5
|
import { registerTraceTool } from "./tools/startTraceCollectionTool.js";
|
|
6
6
|
import { registerTraceStopTool } from "./tools/stopTraceCollectionTool.js";
|
|
7
7
|
import { registerExecuteSkyrampTestTool } from "./tools/executeSkyrampTestTool.js";
|
|
8
|
-
import { registerStopTraceCollectionPrompt } from "./prompts/stopTraceCollectionPrompts.js";
|
|
9
8
|
import { registerTestGenerationPrompt } from "./prompts/testGenerationPrompt.js";
|
|
10
9
|
import { logger } from "./utils/logger.js";
|
|
11
10
|
import { registerUITestTool } from "./tools/generateUIRestTool.js";
|
|
@@ -29,7 +28,6 @@ const server = new McpServer({
|
|
|
29
28
|
// Register prompts
|
|
30
29
|
registerTestGenerationPrompt(server);
|
|
31
30
|
registerStartTraceCollectionPrompt(server);
|
|
32
|
-
registerStopTraceCollectionPrompt(server);
|
|
33
31
|
// Register test generation tools
|
|
34
32
|
registerSmokeTestTool(server);
|
|
35
33
|
registerFuzzTestTool(server);
|
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
// src/prompts/skyrampPrompt.ts
|
|
2
|
-
import { z } from "zod";
|
|
3
2
|
import { logger } from "../utils/logger.js";
|
|
4
3
|
export function registerStartTraceCollectionPrompt(mcpServer) {
|
|
5
4
|
logger.info("registering start trace collection prompt");
|
|
6
|
-
mcpServer.prompt("skyramp_trace_prompt", "Skyramp trace collection prompt", {
|
|
7
|
-
include: z
|
|
8
|
-
.string()
|
|
9
|
-
.describe("Comma-separated list of URLs to include in the trace."),
|
|
10
|
-
exclude: z
|
|
11
|
-
.string()
|
|
12
|
-
.optional()
|
|
13
|
-
.describe("Comma-separated list of URLs to exclude."),
|
|
14
|
-
noProxy: z
|
|
15
|
-
.string()
|
|
16
|
-
.optional()
|
|
17
|
-
.describe("Comma-separated list of noProxy values."),
|
|
18
|
-
runtime: z
|
|
19
|
-
.string()
|
|
20
|
-
.describe("Runtime environment for trace collection. Docker is supported for trace collection."),
|
|
21
|
-
dockerNetwork: z.string().optional(),
|
|
22
|
-
dockerWorkerPort: z.string().optional(),
|
|
23
|
-
playwright: z.string(),
|
|
24
|
-
}, ({ include, exclude, noProxy, runtime, dockerNetwork, dockerWorkerPort, playwright, }) => ({
|
|
5
|
+
mcpServer.prompt("skyramp_trace_prompt", "Skyramp trace collection prompt", {}, () => ({
|
|
25
6
|
messages: [
|
|
26
7
|
{
|
|
27
8
|
role: "user",
|
|
28
9
|
content: {
|
|
29
10
|
type: "text",
|
|
30
|
-
text: `
|
|
31
|
-
|
|
32
|
-
**General information about Skyramp's trace generation:**
|
|
11
|
+
text: `
|
|
12
|
+
**General information about Skyramp's trace collection:**
|
|
33
13
|
* You can start a Skyramp trace session to capture network traffic from an active terminal window and for activity within a browser.
|
|
34
14
|
* Once you start a Skyramp trace session, you can stop it any time. Once stopped, a new session will be required to start a new trace collection.
|
|
35
15
|
* Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/concepts/trace-collection for more details on trace collection.
|
|
36
|
-
* DO NOT assume the runtime environment for trace collection.
|
|
37
|
-
* Spawn a new terminal shell to start a trace collection in the same IDE window.
|
|
38
16
|
* Once you have all the data call the start trace generation tool to start the trace collection.
|
|
39
|
-
*Always ask user if they want to enable playwright for trace collection.
|
|
17
|
+
* Always ask user if they want to enable playwright for trace collection.
|
|
18
|
+
|
|
40
19
|
|
|
41
20
|
**Example usage prompt for trace collection:**
|
|
42
21
|
* To start a trace collection session using agent, run the following command:
|
|
@@ -9,353 +9,100 @@ export function registerTestGenerationPrompt(mcpServer) {
|
|
|
9
9
|
content: {
|
|
10
10
|
type: "text",
|
|
11
11
|
text: `
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* Error Handling:
|
|
108
|
-
- Return clear error if path is not absolute
|
|
109
|
-
- Indicate which parameter needs to be absolute
|
|
110
|
-
- Provide guidance on how to make path absolute
|
|
111
|
-
|
|
112
|
-
**These are the communication guidelines that you MUST follow whenever you are crafting a natural language response to the client:: Add commentMore actions**
|
|
113
|
-
*DO NOT go off topic. Remember that the Skyramp agent is only capable of generating. If the user makes an off-topic request, politely guide the client back on topic and let them know why they went off topic. However, if the user has follow-up questions or comments that are relevant to tests, then you MUST be helpful and answer them.
|
|
114
|
-
*If you are unsure of an answer to a question, DO NOT guess. Remember that you are acting on behalf of Skyramp, and you do NOT want to provide invalid information. It is better to say that you do not know something rather than guessing.
|
|
115
|
-
*Do NOT assume anything about the files generated by Skyramp. You do not know anything about the format and behavior of the Skyramp generated test files, unless explicitly provided to you.
|
|
116
|
-
*Do not unveil any details about the internals of your operations. For example, do not include information about the tools you are using, or the commands that you run for Skyramp operations.
|
|
117
|
-
*Do NOT infer any inputs to Skyramp test generation without first getting explicit confirmation from the client. For example, do not simply assume the value of a URI, or whether a value should be passed to a REST method without first having mentioned this to the user.
|
|
118
|
-
*Be friendly, helpful, professional, and enthusiastic to the client. You MUST NOT sound robotic or boring.
|
|
119
|
-
*If relevant, your natural language responses should use pronouns like "I" or "me" instead of "we", "us", or "Skyramp". Even though you yourself do not perform any actions, you are acting on Skyramp's behalf from the perspective of the client. You can compare it to how a customer service agent acts on behalf of a company.
|
|
120
|
-
*Once again, do NOT overwhelm the user with requests or options. If there is a lot of information, provide high level summaries and let the user know they can ask you for more information.
|
|
121
|
-
*Do NOT overwhelm the user with configuration options. Communicate that to generate a test, you need to know how to reach their service, and what to send to their service. This is an easier way for a user to digest Skyramp's inputs (as opposed to directly asking for schema files, addresses, and ports).
|
|
122
|
-
*To ensure, that the user is aware that there are other options you should mention that Skyramp offers other customization options, and that the user can ask you about what else is available. Do NOT go into details here, to prevent verbosity.
|
|
123
|
-
|
|
124
|
-
**This is some basic information about the capabilities of Skyramp (you can use this for answering questions about the agent):**
|
|
125
|
-
*Skyramp's documentation can be found at skyramp.dev/docs.
|
|
126
|
-
*Skyramp can generate and run various tests for functional testing.
|
|
127
|
-
*At the moment, test generation is ONLY limited to REST for the microservice communication protocol. This means that the tests that Skyramp generates can only make requests to REST based APIs.
|
|
128
|
-
*At the moment, the default language used for test generation is Python. Skyramp currently supports java, javascript, python and typescript languages.
|
|
129
|
-
*At the moment, the default framework used for test generation is Pytest. Skyramp currently supports junit, playwright, pytest and robot frameworks.
|
|
130
|
-
*Skyramp works for testing both publicly available APIs as well as internal applications.
|
|
131
|
-
|
|
132
|
-
**Skyramp supports the following types of tests currently. (Please mention only this if user asks about what you can do)**
|
|
133
|
-
*Contract Test (validate that interfaces remain as defined using sample data)
|
|
134
|
-
*Smoke Test (quickly validate that the most important functions of the API are working)
|
|
135
|
-
*Fuzz Test (send unexpected data to assure APIs behave as expected)
|
|
136
|
-
*Integration Test (test the communication between two or more services)
|
|
137
|
-
*E2E Test (test the entire flow of an application)
|
|
138
|
-
*UI Test (test the user interface of an application)
|
|
139
|
-
*Load Test (test the performance of an application under load)
|
|
140
|
-
|
|
141
|
-
**Quick Reference Table: Required Parameters for Each Test Type**
|
|
142
|
-
| Test Type | Required Inputs (at least one combination) |
|
|
143
|
-
|--------------|-------------------------------------------|
|
|
144
|
-
| Fuzz | endpoint URI, language, framework, method OR endpoint URI, language, framework, method, OpenAPI schema OR endpoint URI, language, framework, method, sample request data OR endpoint URI, language, framework, OpenAPI schema |
|
|
145
|
-
| Smoke | endpoint URI, language, framework, method OR endpoint URI, language, framework, method, OpenAPI schema OR endpoint URI, language, framework, method, sample request data OR endpoint URI, language, framework, method, sample request data, response status code OR endpoint URI, language, framework, OpenAPI schema |
|
|
146
|
-
| Contract | endpoint URI, language, framework, method OR endpoint URI, language, framework, method, OpenAPI schema OR endpoint URI, language, framework, method, sample request data OR endpoint URI, language, framework, method, sample request data, sample response data OR endpoint URI, language, framework, OpenAPI schema |
|
|
147
|
-
| Integration | endpoint URI, language, framework, OpenAPI schema OR endpoint URI, language, framework, OpenAPI schema, sample request data OR trace file, language, framework |
|
|
148
|
-
| Load | endpoint URI, language, framework, method OR endpoint URI, language, framework, OpenAPI schema OR endpoint URI, language, framework, method, sample request data OR trace file, language, framework |
|
|
149
|
-
| E2E | endpoint URI, language, framework, method OR endpoint URI, language, framework, OpenAPI schema OR endpoint URI, language, framework, method, sample request data OR trace file, language, framework |
|
|
150
|
-
| UI | endpoint URI, language, framework, method OR endpoint URI, language, framework, OpenAPI schema OR endpoint URI, language, framework, method, sample request data |
|
|
151
|
-
|
|
152
|
-
**Please follow these guidelines while getting input parameters from user for test generation:**
|
|
153
|
-
*NEVER assume any input values if user has not given information for those input parameters.
|
|
154
|
-
*There are many optional parameters and also parameters that work together. Skyramp will validate the inputs given. So you dont have to validate the combination of parameters that work together.
|
|
155
|
-
*Skyramp can generate tests for a REST endpoint. If the user mentions an endpoint to generate tests for, assign that endpoint URI to the endpointURL parameter.
|
|
156
|
-
*OpenAPI schema can be provided as JSON or YAML file. OpenAPI schema is required if generating test for all methods of an endpoint. Please don't ask for method or assume any method, if the user has provided an OpenAPI schema.
|
|
157
|
-
*If OpenAPI schema or a trace file input is provided, method is not required as an input. Please don't ask for method or assume any method, if user has given trace input file.
|
|
158
|
-
*Sample request data and response data can be provided as JSON blob or JSON file.
|
|
159
|
-
*If the user gave a JSON blob with a filename for request-data, please use the given JSON blob as request-data input.
|
|
160
|
-
*When you see a relative path or file input given by the user, please check from the present working directory first.
|
|
161
|
-
*If user gave authentication header to be used, please don't ask for value of the given header again.
|
|
162
|
-
*If language and framework are not given by user, please use the default language Python and default framework Pytest.
|
|
163
|
-
*For language Python, the valid frameworks available are Pytest and Robot. For language Java, the valid framework available is Junit. For languages Typescript and Javascript, the valid framework available is Playwright.
|
|
164
|
-
*A user can specify path, query, and/or form params as arguments that will be sent for test generation.
|
|
165
|
-
*NEVER replace path parameters or query parameters placeholders in endpoint URI, with values of the path parameters or query parameters given by the user.
|
|
166
|
-
*If both endpoint URI and openAPI schema is given and method is not specified, please don't ask the user for any path parameters or query parameters.
|
|
167
|
-
*If the user's endpoint URI has a path parameter and a method is also specified, please remind user if a path parameter value need to be included. If user decide to proceed without it, you can allow that.
|
|
168
|
-
|
|
169
|
-
**Information about fuzz test generation:**
|
|
170
|
-
|
|
171
|
-
*Fuzz testing (or fuzzing) uncovers bugs and vulnerabilities by injecting random, invalid, or unexpected inputs into an application. It excels at revealing edge cases and security flaws that traditional testing often misses, ensuring software remains robust and secure even under unpredictable conditions.
|
|
172
|
-
*Fuzz tests are useful when testing an endpoint or an application behavior against invalid or unexpected inputs to ensure the application can handle the scenario with grace.
|
|
173
|
-
*By default, Skyramp generates random data for all values in the request body and stores those in a separate dictionary. Additionally, the generated code contains a dictionary that stores the expected status codes for each fuzzed value. The default value is 40X. Below, we explain how to quickly change those values to ensure your desired fuzz strategy.
|
|
174
|
-
- strings: All string values receive the value "0123456789"
|
|
175
|
-
- integer/float: Integers and floats are assigned the value -10
|
|
176
|
-
- boolean: The boolean value is changed to the opposite, e.g. true to false; if no default value is defined, we assign True.
|
|
177
|
-
- enum: A randomly generated string, that is not part of the enum, is assigned.
|
|
178
|
-
*The generated fuzz test will execute in the following way:
|
|
179
|
-
- It will execute a request with the default body values from the API spec or sample data you provide.
|
|
180
|
-
- The test then iterates through each body value, changing the selected body value with a fuzzed value and None while keeping the default values for all other keys.
|
|
181
|
-
- Lastly, it asserts the status codes of all requests. This is done at the end of the loop to avoid premature failure that would lead to unnecessary reruns of the test.
|
|
182
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/fuzz-test for more details on how to generate fuzz tests.
|
|
183
|
-
|
|
184
|
-
**Requirements for Skyramp's fuzz test generation**
|
|
185
|
-
*To reliably generate fuzz test, Skyramp require at least ONE of the following valid input combinations:
|
|
186
|
-
*An endpoint URI, test language, test framework, method.
|
|
187
|
-
*An endpoint URI, test language, test framework, method, an OpenAPI schema.
|
|
188
|
-
*An endpoint URI, test language, test framework, method, a sample request data
|
|
189
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema.
|
|
190
|
-
|
|
191
|
-
Example usage prompt for fuzz test generation:
|
|
192
|
-
Let us generate a fuzz test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, using Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
193
|
-
|
|
194
|
-
**Information about smoke testing:**
|
|
195
|
-
*Smoke testing is a preliminary testing phase where the most critical functionalities of a new software build are quickly checked to ensure they work properly.
|
|
196
|
-
*To identify critical bugs or issues that could prevent further testing by checking core functions like login, navigation, data entry, etc.
|
|
197
|
-
*A quick, high-level set of test cases covering only the most important features, not going into detailed functionality.
|
|
198
|
-
*Early detection of major problems, preventing time wasted on in-depth testing of unstable builds.
|
|
199
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/smoke-test for more details on how to generate smoke tests.
|
|
200
|
-
|
|
201
|
-
**Requirements for Skyramp's smoke test generation**
|
|
202
|
-
*To reliably generate smoke test, Skyramp require at least ONE of the following valid input combinations:
|
|
203
|
-
*An endpoint URI, test language, test framework, method.
|
|
204
|
-
*An endpoint URI, test language, test framework, method, an OpenAPI schema.
|
|
205
|
-
*An endpoint URI, test language, test framework, method, a sample request data.
|
|
206
|
-
*An endpoint URI, test language, test framework, method, a sample request data, response status code.
|
|
207
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema.
|
|
208
|
-
|
|
209
|
-
**Example usage prompt for smoke test generation:**
|
|
210
|
-
*Let us generate a smoke test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
211
|
-
|
|
212
|
-
**Information about contract testing:**
|
|
213
|
-
*A contract test is a specific set of test communication that ensures a service is properly communicating with another service. A contract test asserts an expected condition, specifies valid responses, and evaluates based on whether the responses are returned for that condition.
|
|
214
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/contract-test for more details on how to generate smoke tests.
|
|
215
|
-
|
|
216
|
-
**Requirements for Skyramp's contract test generation**
|
|
217
|
-
*To reliably generate contract test, Skyramp require at least ONE of the following valid input combinations:
|
|
218
|
-
*An endpoint URI, test language, test framework, method.
|
|
219
|
-
*An endpoint URI, test language, test framework, method, an OpenAPI schema.
|
|
220
|
-
*An endpoint URI, test language, test framework, method, a sample request data
|
|
221
|
-
*An endpoint URI, test language, test framework, method, a sample request data, a sample response data.
|
|
222
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema.
|
|
223
|
-
|
|
224
|
-
**Example usage prompt for contract test generation:**
|
|
225
|
-
*Let us generate a contract test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, using Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
226
|
-
|
|
227
|
-
**Information about integration testing:**
|
|
228
|
-
*Integration testing verifies that different components of a system work together as expected.
|
|
229
|
-
*Integration testing catches issues arising from interactions between modules, APIs, or external systems that unit tests might miss. By validating data flow, dependencies, and system behavior, integration testing ensures software functions reliably in real-world environments.
|
|
230
|
-
*Skyramp can generate an integration tests for every method for a REST endpoint. This requires an OpenAPI schema, which can be provided as JSON or YAML file.
|
|
231
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/integration-test for more details on how to generate integration tests.
|
|
232
|
-
|
|
233
|
-
**General information about integration test generation:**
|
|
234
|
-
*Integration testing verifies that different components of a system work together as expected.
|
|
235
|
-
*Integration testing catches issues arising from interactions between modules, APIs, or external systems that unit tests might miss. By validating data flow, dependencies, and system behavior, integration testing ensures software functions reliably in real-world environments.
|
|
236
|
-
*Skyramp can generate an integration tests for every method for a REST endpoint. This requires an OpenAPI schema, which can be provided as JSON or YAML file.
|
|
237
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/integration-test for more details on how to generate integration tests.
|
|
238
|
-
|
|
239
|
-
**Requirements for Skyramp's integration test generation**
|
|
240
|
-
*To reliably generate integration test, Skyramp require at least ONE of the following valid input combinations:
|
|
241
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema.
|
|
242
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema, sample request data.
|
|
243
|
-
*A trace file, test language, test framework
|
|
244
|
-
|
|
245
|
-
**Example usage prompt for integration test generation:**
|
|
246
|
-
*Let us generate an integration test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and use path parameter product_id=4
|
|
247
|
-
|
|
248
|
-
**Information about load testing. General information about load test generation:**
|
|
249
|
-
*With Load testing we are interested in finding whether the application can perform well under a particular load
|
|
250
|
-
*Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/load-test for more details on how to generate integration tests.
|
|
251
|
-
|
|
252
|
-
**Requirements for Skyramp's load test generation**
|
|
253
|
-
*To reliably generate load test, Skyramp require at least ONE of the following valid input combinations:
|
|
254
|
-
*An endpoint URI, test language, test framework, method.
|
|
255
|
-
*An endpoint URI, test language, test framework, an OpenAPI schema.
|
|
256
|
-
*An endpoint URI, test language, test framework, method, a sample request data.
|
|
257
|
-
*A trace file, test language, test framework.
|
|
258
|
-
|
|
259
|
-
**Example usage prompt for load test generation:**
|
|
260
|
-
*Let us generate a load test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
261
|
-
|
|
262
|
-
**Instructions to install Skyramp:**
|
|
263
|
-
1. Install the Skyramp CLI: \`bash -c "$(curl -fsSL https://skyramp.dev/installer.sh)"\`
|
|
264
|
-
2. To ensure that the Skyramp CLI is installed correctly, run the following command: \`skyramp --version\`
|
|
265
|
-
3. Language-specific Installations:
|
|
266
|
-
The Skyramp language-specific library provides the core functionality required for test generation and execution in that language-specific environments.
|
|
267
|
-
- For Python:
|
|
268
|
-
1. Install the Skyramp Python Library via pip: \`pip install skyramp\`
|
|
269
|
-
2. Install the Pytest framework (Optional): \`pip install pytest\`
|
|
270
|
-
3. Install the Robot Framework (Optional): \`pip install robotframework\`
|
|
271
|
-
- For Typescript:
|
|
272
|
-
1. Install the Skyramp TypeScript Library via npm: \`npm install skyramp\`
|
|
273
|
-
2. Install required TypeScript and Node.js typings: \`npm install typescript @types/node\`
|
|
274
|
-
3. Install the Playwright framework: \`npm install playwright @playwright/test\`
|
|
275
|
-
- For Java:
|
|
276
|
-
1. Install the Skyramp Java Library from Maven Central:
|
|
277
|
-
SKYRAMP_VER="0.5.10"
|
|
278
|
-
wget -P lib https://repo1.maven.org/maven2/dev/skyramp/skyramp-library/\${SKYRAMP_VER}/skyramp-library-\${SKYRAMP_VER}.jar
|
|
279
|
-
2. Install Junit:
|
|
280
|
-
JUNIT_PLATFORM_VER="1.9.3"
|
|
281
|
-
JUNIT_JUPITER_VER="5.11.4"
|
|
282
|
-
wget -P lib https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/\${JUNIT_PLATFORM_VER}/junit-platform-console-standalone-\${JUNIT_PLATFORM_VER}.jar
|
|
283
|
-
wget -P lib https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/\${JUNIT_JUPITER_VER}/junit-jupiter-api-\${JUNIT_JUPITER_VER}.jar
|
|
284
|
-
4. Uninstall skyramp:
|
|
285
|
-
To uninstall the Skyramp CLI and remove all associated components, run: \`bash -c "$(curl -fsSL https://skyramp.dev/uninstaller.sh)"\`
|
|
286
|
-
5. For more details, please refer to the Skyramp documentation at https://www.skyramp.dev/docs/quickstart/install
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
**EXECUTION INSTRUCTIONS FOR RUNNING THE GENERATED TESTS:**
|
|
290
|
-
|
|
291
|
-
1. Install the Skyramp Python library via pip: \`pip install skyramp\`.
|
|
292
|
-
2. To test against an application that does require authentication, pass your token using an environment variable (before running the test). By default, Skyramp expects a Bearer Token.\`export SKYRAMP_TEST_TOKEN=$your_auth_token\`
|
|
293
|
-
3. To execute a typescript test file with playwright framework:
|
|
294
|
-
# Prerequisites
|
|
295
|
-
npm init -y
|
|
296
|
-
npm install --save-dev typescript @types/node
|
|
297
|
-
npm install playwright @playwright/test
|
|
298
|
-
# Execution of Test
|
|
299
|
-
npx playwright test <path-to-generated-test-file> --reporter=list
|
|
300
|
-
4. To execute a python test file with pytest framework:
|
|
301
|
-
# Prerequisites
|
|
302
|
-
pip install skyramp
|
|
303
|
-
pip install pytest
|
|
304
|
-
# Execution of Test (for all test types except UI/E2E):
|
|
305
|
-
python3 -m pytest <path-to-generated-test-file>
|
|
306
|
-
# Execution of UI or E2E tests (these require a browser):
|
|
307
|
-
python3 -m pytest --browser chromium <path-to-generated-test-file>
|
|
308
|
-
# You can replace 'chromium' with 'chrome' or 'safari' if desired.
|
|
309
|
-
# For UI tests, ensure you have the required browser installed and available in your environment.
|
|
310
|
-
5. To execute a robot framework test file:
|
|
311
|
-
# Prerequisites
|
|
312
|
-
pip install robotframework
|
|
313
|
-
robot <path-to-generated-robot-file>
|
|
314
|
-
6. To execute a java test file with junit framework:
|
|
315
|
-
# Prerequisites
|
|
316
|
-
Install the Skyramp Python library via pip: \`pip install skyramp\`.
|
|
317
|
-
To test against an application that does require authentication, pass your token using an environment variable (before running the test). By default, Skyramp expects a Bearer Token. \`export SKYRAMP_TEST_TOKEN=$your_auth_token\`
|
|
318
|
-
# Install JUnit Dependencies
|
|
319
|
-
JUNIT_PLATFORM_VER="1.9.3"
|
|
320
|
-
JUNIT_JUPITER_VER="5.11.4"
|
|
321
|
-
wget -P lib https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/\${JUNIT_PLATFORM_VER}/junit-platform-console-standalone-\${JUNIT_PLATFORM_VER}.jar
|
|
322
|
-
wget -P lib https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-api/\${JUNIT_JUPITER_VER}/junit-jupiter-api-\${JUNIT_JUPITER_VER}.jar
|
|
323
|
-
# Compile the generated test code
|
|
324
|
-
# The compiled file *.class will be saved in the /target folder.
|
|
325
|
-
javac -cp "./lib/*" -d target [path to generated test file]
|
|
326
|
-
# Run the Tests
|
|
327
|
-
# Execute the generated JUnit test cases using the JUnit platform console launcher
|
|
328
|
-
JUNIT_PLATFORM_VER="1.9.3"
|
|
329
|
-
classpath="target:$(echo ./lib/*.jar | tr ' ' ':')"
|
|
330
|
-
java -jar "./lib/junit-platform-console-standalone-\${JUNIT_PLATFORM_VER}.jar" \
|
|
331
|
-
--classpath "$classpath" \
|
|
332
|
-
--include-engine=junit-jupiter \
|
|
333
|
-
--scan-classpath \
|
|
334
|
-
--reports-dir=target/test-results
|
|
335
|
-
We are using JUnit's console launcher and its default console output. You can adjust the output behavior following this documentation https://junit.org/junit5/docs/current/user-guide/#running-tests-console-launcher
|
|
336
|
-
7. For more details, please refer to the Skyramp documentation at https://www.skyramp.dev/docs/quickstart/first-test
|
|
337
|
-
|
|
338
|
-
Here are some examples of requests/responses. The information in brackets represents placeholders for configuration properties or information:
|
|
339
|
-
...
|
|
340
|
-
Assistant: I see that you have an OpenAPI file open! From what I see inside the file, it seems like I can reach your service using the URI: [address]. Let me know if that's correct! I can also use the OpenAPI file to help generate the contract test.
|
|
341
|
-
...
|
|
342
|
-
Assistant: I see that you have an OpenAPI file in your repository at /x/y/z/openapi.yaml! I'd recommend opening up the file in the IDE, adding it as a reference to the Copilot chat, then asking me to analyze it so I can do my best to figure out all the configurations for you.
|
|
343
|
-
User: Yes, please analyze the file.
|
|
344
|
-
Assistant: It unfortunately doesn't seem like the file is open, but based on what I think, your service may be reachable at the URI [URI]. Let me know if that is correct.
|
|
345
|
-
...
|
|
346
|
-
Assistant: I see that you have an OpenAPI file in your repository at /x/y/z/openapi.yaml! I'd recommend opening up the file in the IDE, adding it as a reference to the Copilot chat, then asking me to analyze it so I can do my best to figure out all the configurations for you.
|
|
347
|
-
User: Yes, please analyze the file.
|
|
348
|
-
Assistant: Thank you! I analyzed your file contents, and it seems like the service is reachable at the URI [URI]. Let me know if that is correct.
|
|
349
|
-
|
|
350
|
-
{{#if openapi_files}}
|
|
351
|
-
The following OpenAPI files were found in your workspace:
|
|
352
|
-
{{#each openapi_files}}
|
|
353
|
-
- {{this}}
|
|
354
|
-
{{/each}}
|
|
355
|
-
{{/if}}
|
|
356
|
-
|
|
357
|
-
User request:
|
|
358
|
-
|
|
12
|
+
**Core Responsibilities:**
|
|
13
|
+
- Help users generate tests for REST APIs using Skyramp
|
|
14
|
+
- Guide users through test type selection and parameter collection
|
|
15
|
+
- Provide clear execution instructions for generated tests
|
|
16
|
+
- Answer questions about Skyramp capabilities and testing concepts
|
|
17
|
+
|
|
18
|
+
**CONTRACT TEST:**
|
|
19
|
+
- Purpose: Ensures a service is properly communicating with another service
|
|
20
|
+
- Requirements: At least ONE of the following combinations:
|
|
21
|
+
1. Endpoint URI, test language, test framework, method
|
|
22
|
+
2. Endpoint URI, test language, test framework, method, OpenAPI schema
|
|
23
|
+
3. Endpoint URI, test language, test framework, method, sample request data
|
|
24
|
+
4. Endpoint URI, test language, test framework, method, sample request data, sample response data
|
|
25
|
+
5. Endpoint URI, test language, test framework, OpenAPI schema
|
|
26
|
+
|
|
27
|
+
**Sample Contract Test Prompt:**
|
|
28
|
+
\`\`\`
|
|
29
|
+
Let us generate a contract test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, using Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
30
|
+
\`\`\`
|
|
31
|
+
|
|
32
|
+
**SMOKE TEST:**
|
|
33
|
+
- Purpose: Quickly check critical functionalities of a software build
|
|
34
|
+
- Requirements: At least ONE of the following combinations:
|
|
35
|
+
1. Endpoint URI, test language, test framework, method
|
|
36
|
+
2. Endpoint URI, test language, test framework, method, OpenAPI schema
|
|
37
|
+
3. Endpoint URI, test language, test framework, method, sample request data
|
|
38
|
+
4. Endpoint URI, test language, test framework, method, sample request data, response status code
|
|
39
|
+
5. Endpoint URI, test language, test framework, OpenAPI schema
|
|
40
|
+
|
|
41
|
+
**Sample Smoke Test Prompt:**
|
|
42
|
+
\`\`\`
|
|
43
|
+
Let us generate a smoke test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products using GET method, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json.
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
**FUZZ TEST:**
|
|
47
|
+
- Purpose: Uncover bugs by injecting random, invalid, or unexpected inputs
|
|
48
|
+
- Requirements: At least ONE of the following combinations:
|
|
49
|
+
1. Endpoint URI, test language, test framework, method
|
|
50
|
+
2. Endpoint URI, test language, test framework, method, OpenAPI schema
|
|
51
|
+
3. Endpoint URI, test language, test framework, method, sample request data
|
|
52
|
+
4. Endpoint URI, test language, test framework, OpenAPI schema
|
|
53
|
+
|
|
54
|
+
**Sample Fuzz Test Prompt:**
|
|
55
|
+
\`\`\`
|
|
56
|
+
Let us generate a fuzz test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, using Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json and path parameter product_id=4.
|
|
57
|
+
\`\`\`
|
|
58
|
+
|
|
59
|
+
**INTEGRATION TEST:**
|
|
60
|
+
- Purpose: Verify that different components work together as expected
|
|
61
|
+
- Requirements: At least ONE of the following combinations:
|
|
62
|
+
1. A trace file, test language, test framework
|
|
63
|
+
2. Endpoint URI, test language, test framework, OpenAPI schema
|
|
64
|
+
3. Endpoint URI, test language, test framework, OpenAPI schema, sample request data
|
|
65
|
+
|
|
66
|
+
**Sample Integration Test Prompt:**
|
|
67
|
+
\`\`\`
|
|
68
|
+
Let us generate an integration test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
**LOAD TEST:**
|
|
72
|
+
- Purpose: Find whether the application can perform well under a particular load
|
|
73
|
+
- Requirements: At least ONE of the following combinations:
|
|
74
|
+
1. A trace file, test language, test framework
|
|
75
|
+
2. Endpoint URI, test language, test framework, method
|
|
76
|
+
3. Endpoint URI, test language, test framework, OpenAPI schema
|
|
77
|
+
4. Endpoint URI, test language, test framework, method, sample request data
|
|
78
|
+
|
|
79
|
+
**Sample Load Test Prompt:**
|
|
80
|
+
\`\`\`
|
|
81
|
+
Let us generate a load test for the Skyramp endpoint URL https://demoshop.skyramp.dev/api/v1/products, for Python language and Pytest framework. Use openapi file provided at https://demoshop.skyramp.dev/openapi.json
|
|
82
|
+
\`\`\`
|
|
83
|
+
|
|
84
|
+
**E2E TEST:**
|
|
85
|
+
- Purpose: Generate end-to-end tests using both Skyramp and Playwright traces
|
|
86
|
+
- Requirements: A backend trace file, a frontend playwright trace file, test language, test framework
|
|
87
|
+
|
|
88
|
+
**Sample E2E Test Prompt:**
|
|
89
|
+
\`\`\`
|
|
90
|
+
Let us generate an E2E test with backend trace file skyramp-traces.json and frontend playwright trace file skyramp_playwright.zip using Python language and Pytest framework. FQDN to be included is https://demoshop.skyramp.dev/api/v1/products.
|
|
91
|
+
\`\`\`
|
|
92
|
+
|
|
93
|
+
**UI TEST:**
|
|
94
|
+
- Purpose: Generate UI tests using Playwright traces
|
|
95
|
+
- Requirements: A frontend playwright trace file, test language, test framework
|
|
96
|
+
|
|
97
|
+
**Sample UI Test Prompt:**
|
|
98
|
+
\`\`\`
|
|
99
|
+
Let us generate a UI test with frontend playwright trace file skyramp_playwright.zip using Python language and Pytest framework.
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
- Default Language: Python
|
|
103
|
+
- Default Framework: Pytest
|
|
104
|
+
- Supported Languages: Python, Java, JavaScript, TypeScript
|
|
105
|
+
- Supported Frameworks: Pytest, Robot, JUnit, Playwright
|
|
359
106
|
`,
|
|
360
107
|
},
|
|
361
108
|
},
|
|
@@ -120,7 +120,7 @@ For detailed documentation visit: https://www.skyramp.dev/docs/quickstart`,
|
|
|
120
120
|
stream.end();
|
|
121
121
|
statusCode = result.StatusCode;
|
|
122
122
|
logger.debug("Docker container execution completed");
|
|
123
|
-
return container;
|
|
123
|
+
return container.remove();
|
|
124
124
|
})
|
|
125
125
|
.then(function (data) {
|
|
126
126
|
logger.debug("Docker container removed successfully");
|
|
@@ -5,6 +5,7 @@ const integrationTestSchema = {
|
|
|
5
5
|
trace: baseTraceSchema.shape.trace.optional(),
|
|
6
6
|
include: baseTraceSchema.shape.include.optional(),
|
|
7
7
|
exclude: baseTraceSchema.shape.exclude.optional(),
|
|
8
|
+
endpointURL: baseTestSchema.endpointURL.default(""),
|
|
8
9
|
};
|
|
9
10
|
export class IntegrationTestService extends TestGenerationService {
|
|
10
11
|
getTestType() {
|
|
@@ -56,6 +56,10 @@ Load tests evaluate your application's performance, scalability, and stability u
|
|
|
56
56
|
|
|
57
57
|
***IMPORTANT**
|
|
58
58
|
-At any given time you can provide duration of the test or test execution count
|
|
59
|
+
- IF THE USER DOES NOT PROVIDE LOAD PARAMETERS, THEN USE DEFAULT VALUES FOR LOAD TESTS:
|
|
60
|
+
- loadDuration: "5" (5 seconds)
|
|
61
|
+
- loadNumThreads: "1" (1 thread)
|
|
62
|
+
- Other load parameters should remain empty unless explicitly specified by the user
|
|
59
63
|
|
|
60
64
|
For detailed documentation visit: https://www.skyramp.dev/docs/load-test`,
|
|
61
65
|
inputSchema: loadTestSchema,
|
|
@@ -13,21 +13,6 @@ COLLECTION TYPES:
|
|
|
13
13
|
• Backend-Only Tracing: Records API calls and service communications for integration tests
|
|
14
14
|
• Full-Stack Tracing: Combines UI and backend tracing for comprehensive E2E test generation
|
|
15
15
|
|
|
16
|
-
REQUIRED PARAMETERS:
|
|
17
|
-
None - All parameters are optional with sensible defaults
|
|
18
|
-
|
|
19
|
-
OPTIONAL PARAMETERS:
|
|
20
|
-
- playwright: Enable Playwright for UI interaction tracing (default: true)
|
|
21
|
-
- runtime: Execution environment (docker, kubernetes, local) - Defaults to docker
|
|
22
|
-
- include: List of service names or patterns to include in trace collection
|
|
23
|
-
- exclude: List of service names or patterns to exclude from trace collection
|
|
24
|
-
- noProxy: List of hosts or patterns that should bypass proxy during tracing
|
|
25
|
-
- dockerNetwork: Docker network name for containerized trace collection
|
|
26
|
-
- dockerWorkerPort: Port number for the Docker worker service (default: 35142)
|
|
27
|
-
|
|
28
|
-
RUNTIME ENVIRONMENTS:
|
|
29
|
-
• Docker: Containerized tracing with automatic service discovery
|
|
30
|
-
|
|
31
16
|
WORKFLOW:
|
|
32
17
|
1. Start trace collection with desired configuration
|
|
33
18
|
2. Interact with your application (UI clicks, API calls, workflows)
|
|
@@ -42,11 +27,11 @@ For detailed documentation visit:https://www.skyramp.dev/docs/load-test/advanced
|
|
|
42
27
|
.default(true),
|
|
43
28
|
runtime: z
|
|
44
29
|
.string()
|
|
45
|
-
.
|
|
46
|
-
.
|
|
30
|
+
.default("docker")
|
|
31
|
+
.describe("Runtime environment for trace collection. Currently only 'docker' is supported and is used as the default."),
|
|
47
32
|
include: z
|
|
48
33
|
.array(z.string())
|
|
49
|
-
.
|
|
34
|
+
.default([])
|
|
50
35
|
.describe("List of service names or patterns to include in trace collection"),
|
|
51
36
|
exclude: z
|
|
52
37
|
.array(z.string())
|
|
@@ -58,11 +43,11 @@ For detailed documentation visit:https://www.skyramp.dev/docs/load-test/advanced
|
|
|
58
43
|
.describe("List of hosts or patterns that should bypass proxy during tracing"),
|
|
59
44
|
dockerNetwork: z
|
|
60
45
|
.string()
|
|
61
|
-
.
|
|
46
|
+
.default("")
|
|
62
47
|
.describe("Docker network name to use for containerized trace collection"),
|
|
63
48
|
dockerWorkerPort: z
|
|
64
49
|
.number()
|
|
65
|
-
.
|
|
50
|
+
.default(35142)
|
|
66
51
|
.describe("Port number for the Docker worker service during trace collection"),
|
|
67
52
|
},
|
|
68
53
|
annotations: {
|
|
@@ -9,21 +9,6 @@ export function registerTraceStopTool(server) {
|
|
|
9
9
|
|
|
10
10
|
Stopping trace collection finalizes the monitoring process and exports all captured data to specified files. This includes API calls, service communications, user interactions, and network traffic that occurred during the collection period.
|
|
11
11
|
|
|
12
|
-
REQUIRED PARAMETERS:
|
|
13
|
-
- traceOutputFile: Absolute path to save trace data (JSON format) - This file contains collected application interactions for test generation
|
|
14
|
-
- playwright: Boolean flag indicating whether Playwright was used during collection (must match start configuration)
|
|
15
|
-
- playwrightOutput: Absolute path to save Playwright data (ZIP format) - Required when playwright is true, contains UI interaction recordings
|
|
16
|
-
|
|
17
|
-
OUTPUT FILES:
|
|
18
|
-
• Trace File (JSON): Contains backend API calls, service communications, and network traffic data
|
|
19
|
-
• Playwright File (ZIP): Contains UI interaction recordings and browser automation data (when enabled)
|
|
20
|
-
|
|
21
|
-
USAGE WORKFLOW:
|
|
22
|
-
1. Ensure this matches the configuration used when starting trace collection
|
|
23
|
-
2. Provide absolute paths for output files
|
|
24
|
-
3. Generated files can be used immediately for test generation
|
|
25
|
-
4. Trace data reflects real application usage patterns
|
|
26
|
-
|
|
27
12
|
INTEGRATION WITH TEST GENERATION:
|
|
28
13
|
The generated trace and Playwright files can be used as inputs for:
|
|
29
14
|
- Integration test generation (using trace files)
|
package/build/types/TestTypes.js
CHANGED
|
@@ -67,7 +67,7 @@ export const baseTestSchema = {
|
|
|
67
67
|
...baseSchema.shape,
|
|
68
68
|
endpointURL: z
|
|
69
69
|
.string()
|
|
70
|
-
.describe("The endpoint URL to test (e.g., https://
|
|
70
|
+
.describe("The endpoint URL to test (e.g., https://demoshop.skyramp.dev/api/v1/products)"),
|
|
71
71
|
method: z
|
|
72
72
|
.string()
|
|
73
73
|
.default("")
|
package/package.json
CHANGED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
// Utility function to resolve paths to absolute
|
|
4
|
-
function resolveToAbsolutePath(filePath, cwd) {
|
|
5
|
-
if (path.isAbsolute(filePath)) {
|
|
6
|
-
return filePath;
|
|
7
|
-
}
|
|
8
|
-
return path.resolve(cwd, filePath);
|
|
9
|
-
}
|
|
10
|
-
export function registerStopTraceCollectionPrompt(mcpServer) {
|
|
11
|
-
mcpServer.prompt("skyramp_stop_trace_collection_prompt", "Skyramp stop trace collection prompt", {
|
|
12
|
-
traceOutputFile: z
|
|
13
|
-
.string()
|
|
14
|
-
.describe("Path to the trace collection output file (relative or absolute). If relative, it will be resolved relative to the current IDE/project directory."),
|
|
15
|
-
currentWorkingDirectory: z
|
|
16
|
-
.string()
|
|
17
|
-
.describe("The current working directory from the IDE/client context. This is REQUIRED for resolving relative paths to absolute paths."),
|
|
18
|
-
playwright: z
|
|
19
|
-
.string()
|
|
20
|
-
.optional()
|
|
21
|
-
.describe("Whether to use playwright for trace collection. If not provided, it will be set to false."),
|
|
22
|
-
playwrightOutput: z
|
|
23
|
-
.string()
|
|
24
|
-
.optional()
|
|
25
|
-
.describe("Path to the playwright output file (relative or absolute). If relative, it will be resolved relative to the current IDE/project directory. If playwright is enabled, this will be the path to the playwright output file. If playwright is disabled, this will be empty."),
|
|
26
|
-
}, ({ traceOutputFile, currentWorkingDirectory, playwright, playwrightOutput, }) => {
|
|
27
|
-
// Validate currentWorkingDirectory is provided
|
|
28
|
-
if (!currentWorkingDirectory || currentWorkingDirectory.trim() === "") {
|
|
29
|
-
return {
|
|
30
|
-
messages: [
|
|
31
|
-
{
|
|
32
|
-
role: "user",
|
|
33
|
-
content: {
|
|
34
|
-
type: "text",
|
|
35
|
-
text: `**ERROR: Current working directory is required**
|
|
36
|
-
|
|
37
|
-
The currentWorkingDirectory parameter is required to resolve relative paths to absolute paths. Please ensure your IDE/client provides the current working directory context.
|
|
38
|
-
|
|
39
|
-
**Expected Parameters:**
|
|
40
|
-
- traceOutputFile: "${traceOutputFile}"
|
|
41
|
-
- currentWorkingDirectory: [REQUIRED - NOT PROVIDED]
|
|
42
|
-
- playwright: ${playwright || "false"}
|
|
43
|
-
- playwrightOutput: "${playwrightOutput || ""}"
|
|
44
|
-
|
|
45
|
-
**Resolution:** The IDE/client must provide the currentWorkingDirectory parameter to resolve relative paths properly.`,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
],
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
// Resolve paths to absolute
|
|
52
|
-
const absoluteTraceOutputFile = resolveToAbsolutePath(traceOutputFile, currentWorkingDirectory);
|
|
53
|
-
const absolutePlaywrightOutput = playwrightOutput
|
|
54
|
-
? resolveToAbsolutePath(playwrightOutput, currentWorkingDirectory)
|
|
55
|
-
: "";
|
|
56
|
-
return {
|
|
57
|
-
messages: [
|
|
58
|
-
{
|
|
59
|
-
role: "user",
|
|
60
|
-
content: {
|
|
61
|
-
type: "text",
|
|
62
|
-
text: `Information about trace generation:
|
|
63
|
-
**General information about Skyramp's trace collection:**
|
|
64
|
-
* You can start a Skyramp trace session to capture network traffic from an active terminal window and for activity within a browser.
|
|
65
|
-
* Once you start a Skyramp trace session, you can stop it any time. Once stopped, a new session will be required to start a new trace collection.
|
|
66
|
-
* Please refer to the Skyramp documentation at https://www.skyramp.dev/docs/concepts/trace-collection for more details on trace collection.
|
|
67
|
-
|
|
68
|
-
**CRITICAL: You MUST use the following absolute paths for all tool calls:**
|
|
69
|
-
|
|
70
|
-
**Path Resolution Summary:**
|
|
71
|
-
- Original traceOutputFile: "${traceOutputFile}"
|
|
72
|
-
- Current working directory: "${currentWorkingDirectory}"
|
|
73
|
-
- Resolved absolute traceOutputFile: "${absoluteTraceOutputFile}"
|
|
74
|
-
${playwrightOutput ? `- Original playwrightOutput: "${playwrightOutput}"` : ""}
|
|
75
|
-
${playwrightOutput
|
|
76
|
-
? `- Resolved absolute playwrightOutput: "${absolutePlaywrightOutput}"`
|
|
77
|
-
: ""}
|
|
78
|
-
|
|
79
|
-
**Required Absolute Paths for Tool Calls:**
|
|
80
|
-
1. **traceOutputFile parameter**: MUST use exactly this absolute path: "${absoluteTraceOutputFile}"
|
|
81
|
-
2. **playwrightOutput parameter**: ${playwrightOutput
|
|
82
|
-
? `MUST use exactly this absolute path: "${absolutePlaywrightOutput}"`
|
|
83
|
-
: "Not applicable (playwright disabled)"}
|
|
84
|
-
3. **playwright parameter**: ${playwright === "true" ? "true" : "false"}
|
|
85
|
-
|
|
86
|
-
**IMPORTANT: Path Resolution Instructions:**
|
|
87
|
-
- The paths above have been automatically resolved from relative to absolute paths
|
|
88
|
-
- You MUST use these exact absolute paths in all tool calls - do not modify them
|
|
89
|
-
- DO NOT attempt to resolve paths yourself - use the provided absolute paths exactly as shown
|
|
90
|
-
- DO NOT use the original relative paths provided by the user
|
|
91
|
-
|
|
92
|
-
**Tool Call Requirements:**
|
|
93
|
-
When calling skyramp_sop_trace_collection, you MUST use:
|
|
94
|
-
- traceOutputFile: "${absoluteTraceOutputFile}" (this exact absolute path)
|
|
95
|
-
- playwright: ${playwright === "true" ? "true" : "false"}
|
|
96
|
-
- playwrightOutput: "${absolutePlaywrightOutput}" ${!playwrightOutput
|
|
97
|
-
? "(empty string if playwright is false)"
|
|
98
|
-
: "(this exact absolute path)"}
|
|
99
|
-
|
|
100
|
-
**Example Tool Call:**
|
|
101
|
-
\`\`\`
|
|
102
|
-
skyramp_sop_trace_collection({
|
|
103
|
-
traceOutputFile: "${absoluteTraceOutputFile}",
|
|
104
|
-
playwright: ${playwright === "true" ? "true" : "false"},
|
|
105
|
-
playwrightOutput: "${absolutePlaywrightOutput}"
|
|
106
|
-
})
|
|
107
|
-
\`\`\``,
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
}
|