Skip to main content
Glama

get_test_plan

Retrieve a test plan by its key or internal ID. Returns the test plan's ID, key, project ID, and archived status. Use the internal ID for linking, unlinking, or getting linked test cycles.

Instructions

Get a test plan by its key (e.g. FS-TP-43) or internal id. Returns id, key, projectId, archived flag. Use the internal 'id' when calling link/unlink/get_linked_test_cycles.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTest plan ID or key

Implementation Reference

  • Handler function for get_test_plan tool. Accepts an id (string or number) and fetches the test plan from the QMetry API via a GET request to /testplans/:id. Returns the API response wrapped in MCP content format.
    tool(
      "get_test_plan",
      "Get a test plan by its key (e.g. FS-TP-43) or internal id. Returns id, key, projectId, archived flag. Use the internal 'id' when calling link/unlink/get_linked_test_cycles.",
      { id: ID.describe("Test plan ID or key") },
      async ({ id }) => ok(await qtmFetch(`/testplans/${id}`))
    );
  • The input schema for get_test_plan consists of a single parameter 'id' typed as ID, which is a Zod union of string and number.
    const ID = z.union([z.string(), z.number()]);
  • src/index.ts:171-184 (registration)
    The tool registration helper. 'get_test_plan' is registered via the 'tool()' wrapper which calls server.registerTool with the tool name, description, input schema, and callback handler.
    /** 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
      );
  • The 'ok' helper wraps the API response data into the MCP content format (array of text content blocks) used by the handler.
    }
    
    /** Wrap a successful API response as MCP tool content. */
  • The qtmFetch HTTP helper used by the handler to make the GET request to /testplans/:id with API key authentication and rate-limit retry logic.
    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;
    }
Behavior3/5

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

No annotations provided, so description bears the burden. It lists returned fields but does not state read-only nature, error behavior, or idempotency. Adequate but minimal.

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, no redundancy. Every word serves a purpose.

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

Completeness4/5

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

For a simple retrieval tool with one parameter, the description is nearly complete. Could mention what happens if id not found, but overall sufficient given sibling context.

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?

Adds value beyond schema by providing example key format (FS-TP-43) and advising to prefer internal id for subsequent calls. Schema coverage is 100%, but description enriches understanding.

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

Purpose5/5

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

Clearly states the function: getting a test plan by key or internal ID. Distinguishes from siblings like get_test_case and get_test_cycle by specifying the target resource and return fields.

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

Usage Guidelines4/5

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

Provides a concrete usage hint: 'Use the internal id when calling link/unlink/get_linked_test_cycles.' However, does not explicitly contrast with search_test_plans for when to use each.

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