get_test_case
Retrieve a test case by its ID or key and obtain version details including version number, latest version flag, AI generation indicator, and associated test steps.
Instructions
Get a test case by its internal ID or key (e.g. FS-TC-31950). Returns an array of versions, each with versionNo, isLatestVersion, aiGenerated flag, and any test steps.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Test case ID or key (e.g. QTP-TC-1) |
Implementation Reference
- src/index.ts:211-216 (registration)The 'get_test_case' tool is registered using a local 'tool()' wrapper which internally calls server.registerTool(). The tool's name, description, and input schema are defined here.
tool( "get_test_case", "Get a test case by its internal ID or key (e.g. FS-TC-31950). Returns an array of versions, each with versionNo, isLatestVersion, aiGenerated flag, and any test steps.", { id: ID.describe("Test case ID or key (e.g. QTP-TC-1)") }, async ({ id }) => ok(await qtmFetch(`/testcases/${id}`)) ); - src/index.ts:165-165 (schema)The input schema for get_test_case accepts a single 'id' parameter, defined as z.union([z.string(), z.number()]), so it accepts either a test case ID (number) or a key string like 'FS-TC-31950'.
const ID = z.union([z.string(), z.number()]); - src/index.ts:215-215 (handler)The handler function makes a GET request to /testcases/{id} using qtmFetch(), then wraps the result with ok() to format it as MCP tool content.
async ({ id }) => ok(await qtmFetch(`/testcases/${id}`)) - src/index.ts:68-73 (helper)The 'ok()' helper function wraps JSON data into the MCP tool response format (content array with type: text).
/** Wrap a successful API response as MCP tool content. */ function ok(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }], }; } - src/index.ts:171-184 (helper)The 'tool()' wrapper function handles registration by calling server.registerTool() with the provided name, description, inputSchema, and callback.
/** Thin wrapper around registerTool for concise, non-deprecated tool registration. */ const tool = <Shape extends z.ZodRawShape>( name: string, description: string, inputSchema: Shape, // eslint-disable-next-line @typescript-eslint/no-explicit-any callback: (args: z.infer<z.ZodObject<Shape>>) => Promise<any> ) => server.registerTool( name, { description, inputSchema }, // eslint-disable-next-line @typescript-eslint/no-explicit-any callback as any );