kickload-watcher-mcp 0.1.2 → 0.1.3

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 (2) hide show
  1. package/kickload-client.js +42 -25
  2. package/package.json +1 -1
@@ -82,34 +82,19 @@ export class KickloadClient {
82
82
  // Returns: { status: "success", jmx_filename: "test_plan_xxx.jmx" }
83
83
  // ══════════════════════════════════════════════════════════════
84
84
  async generateTestPlan({ prompt, jmxFilePath } = {}) {
85
- if (!prompt && !jmxFilePath) {
86
- throw new Error("generateTestPlan: provide at least a prompt or jmxFilePath");
87
- }
88
-
89
- const form = new FormData();
90
-
91
- if (prompt) {
92
- form.append("prompt", prompt);
93
- }
94
-
95
- if (jmxFilePath) {
96
- const resolved = path.resolve(jmxFilePath);
97
- if (!fs.existsSync(resolved)) {
98
- throw new Error(`JMX file not found: ${resolved}`);
99
- }
100
- form.append("file", fs.createReadStream(resolved), {
101
- filename: path.basename(resolved),
102
- contentType: "application/xml",
103
- });
104
- }
85
+ if (!prompt && !jmxFilePath) {
86
+ throw new Error("generateTestPlan: provide at least a prompt or jmxFilePath");
87
+ }
105
88
 
106
- console.log("\n📋 STEP 1: Generating test plan...");
107
- if (prompt) console.log(` Prompt : ${prompt.substring(0, 100)}`);
108
- if (jmxFilePath) console.log(` JMX file: ${jmxFilePath}`);
89
+ console.log("\n📋 STEP 1: Generating test plan...");
90
+ if (prompt) console.log(` Prompt : ${prompt.substring(0, 100)}`);
91
+ if (jmxFilePath) console.log(` JMX file: ${jmxFilePath}`);
109
92
 
93
+ // ✅ FIX: send JSON when only prompt is provided
94
+ if (prompt && !jmxFilePath) {
110
95
  const result = await this._fetch("POST", "/generate-test-plan", {
111
- body: form,
112
- headers: form.getHeaders(),
96
+ body: JSON.stringify({ prompt }),
97
+ isJson: true,
113
98
  });
114
99
 
115
100
  if (result.status !== "success") {
@@ -122,6 +107,38 @@ export class KickloadClient {
122
107
  return result;
123
108
  }
124
109
 
110
+ // ✅ fallback: use FormData only if file is present
111
+ const form = new FormData();
112
+
113
+ if (prompt) {
114
+ form.append("prompt", prompt);
115
+ }
116
+
117
+ if (jmxFilePath) {
118
+ const resolved = path.resolve(jmxFilePath);
119
+ if (!fs.existsSync(resolved)) {
120
+ throw new Error(`JMX file not found: ${resolved}`);
121
+ }
122
+ form.append("file", fs.createReadStream(resolved), {
123
+ filename: path.basename(resolved),
124
+ contentType: "application/xml",
125
+ });
126
+ }
127
+
128
+ const result = await this._fetch("POST", "/generate-test-plan", {
129
+ body: form,
130
+ headers: form.getHeaders(),
131
+ });
132
+
133
+ if (result.status !== "success") {
134
+ throw new Error(
135
+ `Test plan generation failed: ${result.message || JSON.stringify(result)}`
136
+ );
137
+ }
138
+
139
+ console.log(`✅ STEP 1 done — JMX: ${result.jmx_filename}`);
140
+ return result;
141
+ }
125
142
  // ══════════════════════════════════════════════════════════════
126
143
  // STEP 2 — Run Test
127
144
  // POST /run-test/{jmx_filename}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kickload-watcher-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Automated API performance testing for Claude Code teams via KickLoad",
5
5
  "main": "index.js",
6
6
  "type": "module",