Skip to main content
Glama

create_test_case

Create a test case in QMetry Test Management. Provide project ID and summary, optionally set priority, status, assignee, labels, components, fix versions, folder, and custom fields. Returns the test case key and internal ID.

Instructions

Create a new test case in QMetry. Returns the created test case object including its internal id and key (e.g. FS-TC-123). Priority, status, labels, and components use integer IDs — see field_reference.json for valid values.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesJira project numeric ID (e.g. 10011)
summaryYesTest case title/summary
preconditionNoPrecondition / description text
priorityNoPriority integer ID (e.g. 600784 for High)
statusNoStatus integer ID (e.g. 544256 for Done)
assigneeNoAssignee Jira account ID
labelsNoLabel IDs to attach
componentsNoComponent IDs
fixVersionsNoFix version IDs
folderIdNoTarget folder ID
customFieldsNoCustom field values

Implementation Reference

  • Handler function for the create_test_case tool. Sends a POST request to /testcases with the provided body, which includes projectId, summary, and optional fields. The result is wrapped with the ok() helper and returned as MCP content.
    async (body) => {
      return ok(await qtmFetch("/testcases", { method: "POST", body: JSON.stringify(body) }));
    }
  • Input schema for create_test_case defined with Zod. Required fields: projectId, summary. Optional fields: precondition, priority, status, assignee, labels, components, fixVersions, folderId, customFields.
    {
      projectId: z.union([z.string(), z.number()]).describe("Jira project numeric ID (e.g. 10011)"),
      summary: z.string().describe("Test case title/summary"),
      precondition: z.string().optional().describe("Precondition / description text"),
      priority: z.number().int().optional().describe("Priority integer ID (e.g. 600784 for High)"),
      status: z.number().int().optional().describe("Status integer ID (e.g. 544256 for Done)"),
      assignee: z.string().optional().describe("Assignee Jira account ID"),
      labels: z.array(z.number().int()).optional().describe("Label IDs to attach"),
      components: z.array(z.number().int()).optional().describe("Component IDs"),
      fixVersions: z.array(z.number().int()).optional().describe("Fix version IDs"),
      folderId: z.number().int().optional().describe("Target folder ID"),
      customFields: z.array(CustomField).optional().describe("Custom field values"),
    },
  • src/index.ts:190-209 (registration)
    Registration of the tool named 'create_test_case' using the local tool() wrapper which internally calls server.registerTool() on the McpServer instance.
    tool(
      "create_test_case",
      "Create a new test case in QMetry. Returns the created test case object including its internal id and key (e.g. FS-TC-123). Priority, status, labels, and components use integer IDs — see field_reference.json for valid values.",
      {
        projectId: z.union([z.string(), z.number()]).describe("Jira project numeric ID (e.g. 10011)"),
        summary: z.string().describe("Test case title/summary"),
        precondition: z.string().optional().describe("Precondition / description text"),
        priority: z.number().int().optional().describe("Priority integer ID (e.g. 600784 for High)"),
        status: z.number().int().optional().describe("Status integer ID (e.g. 544256 for Done)"),
        assignee: z.string().optional().describe("Assignee Jira account ID"),
        labels: z.array(z.number().int()).optional().describe("Label IDs to attach"),
        components: z.array(z.number().int()).optional().describe("Component IDs"),
        fixVersions: z.array(z.number().int()).optional().describe("Fix version IDs"),
        folderId: z.number().int().optional().describe("Target folder ID"),
        customFields: z.array(CustomField).optional().describe("Custom field values"),
      },
      async (body) => {
        return ok(await qtmFetch("/testcases", { method: "POST", body: JSON.stringify(body) }));
      }
    );
  • qtmFetch() helper function that makes authenticated HTTP requests to the QMetry API, including exponential back-off retry for rate limiting (429).
    async function qtmFetch(
      path: string,
      options: RequestInit = {},
      attempt = 1
    ): Promise<unknown> {
      const url = `${BASE_URL}${path}`;
      const headers: Record<string, string> = {
        apiKey: API_KEY ?? "",
        "Content-Type": "application/json",
        Accept: "application/json",
        ...(options.headers as Record<string, string> | undefined),
      };
    
      const response = await fetch(url, { ...options, headers });
    
      // Exponential back-off for rate limiting (max 3 attempts)
      if (response.status === 429 && attempt < 3) {
        const retryAfter = Number.parseInt(
          response.headers.get("Retry-After") ?? "1",
          10
        );
        const delay = Math.max(retryAfter * 1000, 1000) * attempt;
        await new Promise((r) => setTimeout(r, delay));
        return qtmFetch(path, options, attempt + 1);
      }
    
      const text = await response.text();
      let body: unknown;
      try {
        body = text ? JSON.parse(text) : null;
      } catch {
        body = text;
      }
    
      if (!response.ok) {
        throw new Error(
          `HTTP ${response.status} ${response.statusText}: ${JSON.stringify(body)}`
        );
      }
    
      return body;
    }
  • ok() helper function that wraps API response data into the MCP tool content format (text type).
    /** 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) }],
      };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description must disclose behavioral traits. It only mentions creation and return value, omitting side effects, permission requirements, or rate limits. Minimal transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no fluff. Purpose, return value, and key parameter hint are front-loaded. Every sentence is meaningful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 11 parameters and no output schema, description could be more complete. It explains integer-ID fields and return value, but leaves out customFields, folderId, and other parameter semantics. Adequate but not comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverate is 100%, but description adds value by summarizing that priority, status, labels, components use integer IDs and referencing field_reference.json for valid values. This helps agents beyond the schema alone.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it creates a test case in QMetry and returns the created object with id and key. However, it does not explicitly differentiate from sibling tools like clone_test_cases or update_test_case.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides guidance that integer IDs come from field_reference.json, but no advice on when to use this vs alternatives (e.g., cloning or importing). No context on prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/salehrifai42/qmetrymcp'

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