testplan_add_test_cases_to_suite
Adds existing test cases to a specified test suite in an Azure DevOps project by providing project ID, test plan ID, suite ID, and test case IDs.
Instructions
Adds existing test cases to a test suite.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| planId | Yes | The ID of the test plan. | |
| project | Yes | The unique identifier (ID or name) of the Azure DevOps project. | |
| suiteId | Yes | The ID of the test suite. | |
| testCaseIds | Yes | The ID(s) of the test case(s) to add. |
Implementation Reference
- src/tools/testplans.ts:94-106 (handler)The handler function that executes the tool logic: connects to Azure DevOps, converts testCaseIds to string if array, calls testApi.addTestCasesToSuite, and returns JSON stringified result.async ({ project, planId, suiteId, testCaseIds }) => { const connection = await connectionProvider(); const testApi = await connection.getTestApi(); // If testCaseIds is an array, convert it to comma-separated string const testCaseIdsString = Array.isArray(testCaseIds) ? testCaseIds.join(",") : testCaseIds; const addedTestCases = await testApi.addTestCasesToSuite(project, planId, suiteId, testCaseIdsString); return { content: [{ type: "text", text: JSON.stringify(addedTestCases, null, 2) }], }; }
- src/tools/testplans.ts:88-93 (schema)Zod schema defining input parameters for the tool.{ project: z.string().describe("The unique identifier (ID or name) of the Azure DevOps project."), planId: z.number().describe("The ID of the test plan."), suiteId: z.number().describe("The ID of the test suite."), testCaseIds: z.string().or(z.array(z.string())).describe("The ID(s) of the test case(s) to add. "), },
- src/tools/testplans.ts:85-107 (registration)Registers the 'testplan_add_test_cases_to_suite' tool on the MCP server with description, input schema, and handler function.server.tool( Test_Plan_Tools.add_test_cases_to_suite, "Adds existing test cases to a test suite.", { project: z.string().describe("The unique identifier (ID or name) of the Azure DevOps project."), planId: z.number().describe("The ID of the test plan."), suiteId: z.number().describe("The ID of the test suite."), testCaseIds: z.string().or(z.array(z.string())).describe("The ID(s) of the test case(s) to add. "), }, async ({ project, planId, suiteId, testCaseIds }) => { const connection = await connectionProvider(); const testApi = await connection.getTestApi(); // If testCaseIds is an array, convert it to comma-separated string const testCaseIdsString = Array.isArray(testCaseIds) ? testCaseIds.join(",") : testCaseIds; const addedTestCases = await testApi.addTestCasesToSuite(project, planId, suiteId, testCaseIdsString); return { content: [{ type: "text", text: JSON.stringify(addedTestCases, null, 2) }], }; } );
- src/tools/testplans.ts:10-17 (registration)Defines constant object with tool names, including 'testplan_add_test_cases_to_suite' used in registration.const Test_Plan_Tools = { create_test_plan: "testplan_create_test_plan", create_test_case: "testplan_create_test_case", add_test_cases_to_suite: "testplan_add_test_cases_to_suite", test_results_from_build_id: "testplan_show_test_results_from_build_id", list_test_cases: "testplan_list_test_cases", list_test_plans: "testplan_list_test_plans", };