Skip to main content
Glama
leorosignoli

JIRA Zephyr MCP Server

by leorosignoli

create_multiple_test_cases

Create multiple test cases in Zephyr simultaneously to streamline test management and reduce manual entry time.

Instructions

Create multiple test cases in Zephyr at once

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
testCasesYesArray of test cases to create
continueOnErrorNoContinue creating remaining test cases if one fails (default: true)

Implementation Reference

  • The primary handler function for the 'create_multiple_test_cases' tool. It validates the input using the schema, calls the ZephyrClient to perform the creation, and formats the response.
    export const createMultipleTestCases = async (input: CreateMultipleTestCasesInput) => { const validatedInput = createMultipleTestCasesSchema.parse(input); try { const result = await getZephyrClient().createMultipleTestCases( validatedInput.testCases, validatedInput.continueOnError ); return { success: true, data: { results: result.results.map(r => ({ index: r.index, success: r.success, testCase: r.success ? { id: r.data?.id, key: r.data?.key, name: r.data?.name, projectKey: r.data?.project?.id, objective: r.data?.objective, precondition: r.data?.precondition, estimatedTime: r.data?.estimatedTime, priority: r.data?.priority?.id, status: r.data?.status?.id, folder: r.data?.folder?.id, labels: r.data?.labels || [], component: r.data?.component?.id, owner: r.data?.owner?.accountId, createdOn: r.data?.createdOn, links: { self: r.data ? `https://api.zephyrscale.smartbear.com/v2/testcases/${r.data.key}` : undefined, }, } : undefined, error: r.error, })), summary: result.summary, }, }; } catch (error: any) { return { success: false, error: error.response?.data?.message || error.message, }; } };
  • Zod schema for validating the input to the create_multiple_test_cases tool, along with the inferred TypeScript type.
    export const createMultipleTestCasesSchema = z.object({ testCases: z.array(createTestCaseSchema).min(1, 'At least one test case is required'), continueOnError: z.boolean().default(true), }); export type CreateTestPlanInput = z.infer<typeof createTestPlanSchema>; export type CreateTestCycleInput = z.infer<typeof createTestCycleSchema>; export type ReadJiraIssueInput = z.infer<typeof readJiraIssueSchema>; export type ListTestPlansInput = z.infer<typeof listTestPlansSchema>; export type ListTestCyclesInput = z.infer<typeof listTestCyclesSchema>; export type ExecuteTestInput = z.infer<typeof executeTestSchema>; export type GetTestExecutionStatusInput = z.infer<typeof getTestExecutionStatusSchema>; export type LinkTestsToIssuesInput = z.infer<typeof linkTestsToIssuesSchema>; export type GenerateTestReportInput = z.infer<typeof generateTestReportSchema>; export type CreateTestCaseInput = z.infer<typeof createTestCaseSchema>; export type SearchTestCasesInput = z.infer<typeof searchTestCasesSchema>; export type GetTestCaseInput = z.infer<typeof getTestCaseSchema>; export type CreateMultipleTestCasesInput = z.infer<typeof createMultipleTestCasesSchema>;
  • src/index.ts:473-483 (registration)
    Registration and dispatch logic in the main server handler switch statement. Validates arguments again and calls the tool handler.
    case 'create_multiple_test_cases': { const validatedArgs = validateInput<CreateMultipleTestCasesInput>(createMultipleTestCasesSchema, args, 'create_multiple_test_cases'); return { content: [ { type: 'text', text: JSON.stringify(await createMultipleTestCases(validatedArgs), null, 2), }, ], }; }
  • src/index.ts:252-305 (registration)
    Tool registration in the TOOLS array, defining name, description, and input schema for the MCP server.
    name: 'create_multiple_test_cases', description: 'Create multiple test cases in Zephyr at once', inputSchema: { type: 'object', properties: { testCases: { type: 'array', items: { type: 'object', properties: { projectKey: { type: 'string', description: 'JIRA project key' }, name: { type: 'string', description: 'Test case name' }, objective: { type: 'string', description: 'Test case objective/description (optional)' }, precondition: { type: 'string', description: 'Test preconditions (optional)' }, estimatedTime: { type: 'number', description: 'Estimated execution time in minutes (optional)' }, priority: { type: 'string', description: 'Test case priority (optional)' }, status: { type: 'string', description: 'Test case status (optional)' }, folderId: { type: 'string', description: 'Folder ID to organize test case (optional)' }, labels: { type: 'array', items: { type: 'string' }, description: 'Test case labels (optional)' }, componentId: { type: 'string', description: 'Component ID (optional)' }, customFields: { type: 'object', description: 'Custom fields as key-value pairs (optional)' }, testScript: { type: 'object', description: 'Test script with steps (optional)', properties: { type: { type: 'string', enum: ['STEP_BY_STEP', 'PLAIN_TEXT'], description: 'Script type' }, steps: { type: 'array', items: { type: 'object', properties: { index: { type: 'number', description: 'Step number' }, description: { type: 'string', description: 'Step description' }, testData: { type: 'string', description: 'Test data (optional)' }, expectedResult: { type: 'string', description: 'Expected result' }, }, required: ['index', 'description', 'expectedResult'], }, description: 'Test steps (for STEP_BY_STEP type)', }, text: { type: 'string', description: 'Plain text script (for PLAIN_TEXT type)' }, }, required: ['type'], }, }, required: ['projectKey', 'name'], }, description: 'Array of test cases to create', }, continueOnError: { type: 'boolean', description: 'Continue creating remaining test cases if one fails (default: true)', default: true }, }, required: ['testCases'], }, },
  • Supporting method in ZephyrClient that implements the batch creation logic by looping over test cases, calling createTestCase for each, and handling individual errors.
    async createMultipleTestCases(testCases: Array<{ projectKey: string; name: string; objective?: string; precondition?: string; estimatedTime?: number; priority?: string; status?: string; folderId?: string; labels?: string[]; componentId?: string; customFields?: Record<string, any>; testScript?: { type: 'STEP_BY_STEP' | 'PLAIN_TEXT'; steps?: Array<{ index: number; description: string; testData?: string; expectedResult: string; }>; text?: string; }; }>, continueOnError = true): Promise<{ results: Array<{ index: number; success: boolean; data?: ZephyrTestCase; error?: string; }>; summary: { total: number; successful: number; failed: number; }; }> { const results = []; let successful = 0; let failed = 0; for (let i = 0; i < testCases.length; i++) { try { const testCase = await this.createTestCase(testCases[i]); results.push({ index: i, success: true, data: testCase, }); successful++; } catch (error: any) { const errorMessage = error.response?.data?.message || error.message; results.push({ index: i, success: false, error: errorMessage, }); failed++; if (!continueOnError) { break; } } } return { results, summary: { total: testCases.length, successful, failed, }, }; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/leorosignoli/jira-zephyr-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server