create_test_plan
Create structured test plans in JIRA Zephyr to organize testing activities, define scope, and track progress for software quality assurance.
Instructions
Create a new test plan in Zephyr
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Test plan name | |
| description | No | Test plan description (optional) | |
| projectKey | Yes | JIRA project key | |
| startDate | No | Planned start date (ISO format, optional) | |
| endDate | No | Planned end date (ISO format, optional) |
Implementation Reference
- src/tools/test-plans.ts:18-49 (handler)Main tool handler: validates input using Zod schema, calls ZephyrClient to create test plan, formats and returns success/error response.export const createTestPlan = async (input: CreateTestPlanInput) => { const validatedInput = createTestPlanSchema.parse(input); try { const testPlan = await getZephyrClient().createTestPlan({ name: validatedInput.name, description: validatedInput.description, projectKey: validatedInput.projectKey, startDate: validatedInput.startDate, endDate: validatedInput.endDate, }); return { success: true, data: { id: testPlan.id, key: testPlan.key, name: testPlan.name, description: testPlan.description, projectId: testPlan.projectId, status: testPlan.status, createdOn: testPlan.createdOn, createdBy: testPlan.createdBy.displayName, }, }; } catch (error: any) { return { success: false, error: error.response?.data?.message || error.message, }; } };
- src/utils/validation.ts:3-9 (schema)Zod schema for input validation and TypeScript type inference for CreateTestPlanInput.export const createTestPlanSchema = z.object({ name: z.string().min(1, 'Name is required'), description: z.string().optional(), projectKey: z.string().min(1, 'Project key is required'), startDate: z.string().optional(), endDate: z.string().optional(), });
- src/index.ts:77-90 (registration)Tool registration in MCP server's TOOLS list, including name, description, and static JSON inputSchema for discovery.name: 'create_test_plan', description: 'Create a new test plan in Zephyr', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Test plan name' }, description: { type: 'string', description: 'Test plan description (optional)' }, projectKey: { type: 'string', description: 'JIRA project key' }, startDate: { type: 'string', description: 'Planned start date (ISO format, optional)' }, endDate: { type: 'string', description: 'Planned end date (ISO format, optional)' }, }, required: ['name', 'projectKey'], }, },
- src/index.ts:341-351 (registration)MCP CallToolRequest handler switch case that validates args and invokes the createTestPlan tool function.case 'create_test_plan': { const validatedArgs = validateInput<CreateTestPlanInput>(createTestPlanSchema, args, 'create_test_plan'); return { content: [ { type: 'text', text: JSON.stringify(await createTestPlan(validatedArgs), null, 2), }, ], }; }
- src/clients/zephyr-client.ts:23-40 (helper)ZephyrClient helper method that performs the actual HTTP POST to Zephyr Scale API to create the test plan.async createTestPlan(data: { name: string; description?: string; projectKey: string; startDate?: string; endDate?: string; }): Promise<ZephyrTestPlan> { const payload = { name: data.name, objective: data.description, projectKey: data.projectKey, plannedStartDate: data.startDate, plannedEndDate: data.endDate, }; const response = await this.client.post('/testplans', payload); return response.data; }