targetprocess-mcp-server 2.0.2 → 2.0.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.
package/README.md CHANGED
@@ -60,8 +60,8 @@ Cards — Write
60
60
  - `add_test_cases` — Create a test plan and add generated test cases to it in one call (resourceId, testPlanTitle, testCases array of {name, description}, optional resourceType)
61
61
 
62
62
  Test Case Workflows
63
- - `write_test_cases` — Fetch a card (UserStory, Bug, or Feature) by ID and trigger the full test case writing workflow: Claude analyzes the card, generates detailed HTML-formatted test cases covering happy path, edge cases, and error scenarios, creates a linked test plan, then calls `add_test_cases_to_test_plan` (resourceId, optional resourceType)
64
- - `add_test_cases_to_test_plan` — Add an array of pre-generated test cases to an existing test plan by its ID (testPlanId, testCases array of {name, description})
63
+ - `write_test_cases` — Fetch a card (UserStory, Bug, or Feature) by ID and trigger the full test case writing workflow: Claude analyzes the card, generates detailed test cases covering happy path, edge cases, and error scenarios, creates a linked test plan via `create_test_plan`, then calls `add_test_cases_to_test_plan`. Each test case description contains Preconditions and Test Type as HTML; steps are passed as a structured array (resourceId, optional resourceType)
64
+ - `add_test_cases_to_test_plan` — Add pre-generated test cases to an existing test plan. Each test case has a `name`, an HTML `description` (Preconditions and Test Type only), and a `steps` array of `{ description, result }` objects — steps are created via the TP test step API rather than embedded in the description (testPlanId, testCases array of {name, description, steps})
65
65
 
66
66
  Projects
67
67
  - `get_projects` — Get all Targetprocess projects (no params needed)
package/build/index.js CHANGED
@@ -952,15 +952,12 @@ server.registerTool('write_test_cases', {
952
952
  CRITICAL WORKFLOW — after receiving the card content, you MUST:
953
953
  1) Thoroughly analyze the card name and description to understand the feature or issue being tested
954
954
  2) Write detailed test cases covering: happy path, edge cases, boundary conditions, and error scenarios
955
- 3) Format each test case description inside an html <div> element structured as:
956
- <div>
957
- <p><strong>Preconditions:</strong> ...</p>
958
- <p><strong>Test Steps:</strong><ol><li>...</li></ol></p>
959
- <p><strong>Expected Result:</strong> ...</p>
960
- <p><strong>Test Type:</strong> ...</p>
961
- </div>
962
- 4) Call "create_test_plan" tool passing: resourceId (the card id), resourceType, testPlanTitle (use the card name prefixed with "Test Plan: "), and the testCases array
963
- 5) Call "add_test_case_to_test_plan" tool passing: testPlanId (the test plan id), and the testCases array`,
955
+ 3) For each test case produce:
956
+ - name: concise action-oriented title
957
+ - description: HTML <div> with Preconditions and Test Type sections only (no steps here)
958
+ - steps: ordered array of { description: "<step action>", result: "<expected result>" }
959
+ 4) Call "create_test_plan" tool passing: resourceId (the card id), resourceType, testPlanTitle (use the card name/title)
960
+ 5) Call "add_test_cases_to_test_plan" tool passing: testPlanId (the test plan id), and the testCases array with name, description, and steps`,
964
961
  inputSchema: {
965
962
  resourceId: z.string()
966
963
  .min(5)
@@ -1018,35 +1015,50 @@ server.registerTool('add_test_cases_to_test_plan', {
1018
1015
  testPlanId: z.string()
1019
1016
  .min(5)
1020
1017
  .max(6)
1021
- .describe('TP card ID to link the test plan to (e.g. 145789)'),
1018
+ .describe('Test plan ID to add test cases to (e.g. 145789)'),
1022
1019
  testCases: z.array(z.object({
1023
1020
  name: z.string()
1024
1021
  .describe('Test case title (concise, action-oriented)'),
1025
1022
  description: z.string()
1026
- .describe('Test case steps and expected results formatted as HTML'),
1023
+ .describe('Test case context formatted as HTML — include Preconditions and Test Type sections, but NOT test steps (those go in the steps field)'),
1024
+ steps: z.array(z.object({
1025
+ description: z.string()
1026
+ .describe('Step action text'),
1027
+ result: z.string()
1028
+ .describe('Expected result for this step'),
1029
+ }))
1030
+ .min(1)
1031
+ .describe('Ordered list of test steps with their expected results'),
1027
1032
  }))
1028
1033
  .min(1)
1029
- .describe('Array of test cases to create in the new test plan'),
1034
+ .describe('Array of test cases to create in the test plan'),
1030
1035
  },
1031
1036
  }, async ({ testPlanId, testCases }) => {
1032
1037
  const created = [];
1033
1038
  const failed = [];
1034
1039
  for (const tc of testCases) {
1035
- const result = await tp.createTestCase(tc.name, tc.description, String(testPlanId));
1036
- if (result) {
1037
- created.push({ id: result.Id, name: result.Name });
1038
- }
1039
- else {
1040
+ const testCase = await tp.createTestCase(tc.name, tc.description, String(testPlanId));
1041
+ if (!testCase) {
1040
1042
  failed.push(tc.name);
1043
+ continue;
1044
+ }
1045
+ let stepsAdded = 0;
1046
+ let stepsFailed = 0;
1047
+ for (const step of tc.steps) {
1048
+ const stepResult = await tp.addTestStep(String(testCase.Id), step);
1049
+ if (stepResult) {
1050
+ stepsAdded++;
1051
+ }
1052
+ else {
1053
+ stepsFailed++;
1054
+ }
1041
1055
  }
1056
+ created.push({ id: testCase.Id, name: testCase.Name, stepsAdded, stepsFailed });
1042
1057
  }
1043
1058
  return {
1044
1059
  content: [{
1045
1060
  type: 'text',
1046
- text: JSON.stringify({
1047
- created,
1048
- failed,
1049
- })
1061
+ text: JSON.stringify({ created, failed })
1050
1062
  }]
1051
1063
  };
1052
1064
  });
package/build/tp.js CHANGED
@@ -192,7 +192,7 @@ export class TpClient {
192
192
  }
193
193
  async createTestPlan(title, resourceId, resourceType = 'UserStory', options) {
194
194
  const testPlan = {
195
- "Name": title,
195
+ "Name": `Test Plan: ${title}`,
196
196
  "Project": {
197
197
  "Id": config.tp.projectId
198
198
  },
@@ -242,6 +242,17 @@ export class TpClient {
242
242
  param: { "format": "json" },
243
243
  }, commentData);
244
244
  }
245
+ async addTestStep(testCaseId, testStep) {
246
+ const testStepData = {
247
+ "Description": testStep.description,
248
+ "Result": testStep.result,
249
+ "TestCase": { "Id": testCaseId },
250
+ };
251
+ return this.post({
252
+ pathParam: { "testSteps": '' },
253
+ param: { "format": "json" },
254
+ }, testStepData);
255
+ }
245
256
  async getBugComments(bugId, results = 25) {
246
257
  const response = await this.get({
247
258
  pathParam: {
package/package.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "engines": {
26
26
  "node": ">=20.x"
27
27
  },
28
- "version": "2.0.2",
28
+ "version": "2.0.3",
29
29
  "description": "MCP server for Tartget Process",
30
30
  "main": "build/index.js",
31
31
  "keywords": [