Skip to main content
Glama
TCSoftInc

TestCollab MCP Server

by TCSoftInc

get_test_case

Retrieve detailed test cases including steps and expected results by ID for test management in TestCollab MCP Server.

Instructions

Fetch a single test case with full details, including steps and expected results.

Required: id (test case ID) Optional: project_id, parse_reusable_steps (default: true)

Example: { "id": 1835, "parse_reusable_steps": true }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesTest case ID to retrieve (required)
project_idNoProject ID (uses default if not specified)
parse_reusable_stepsNoParse reusable steps into full steps (default: true)

Implementation Reference

  • The handler function for the get_test_case tool, which validates inputs, fetches test case data via the API client, normalizes the response, and formats the result as a text message containing the test case details and any missing steps.
    export async function handleGetTestCase(
      args: unknown
    ): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      // Validate input
      const parsed = getTestCaseSchema.safeParse(args);
      if (!parsed.success) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: {
                  code: "VALIDATION_ERROR",
                  message: "Invalid input parameters",
                  details: parsed.error.errors,
                },
              }),
            },
          ],
        };
      }
    
      const { id, project_id, parse_reusable_steps } = parsed.data;
    
      // Resolve project ID: check request context first (HTTP), then env config (stdio)
      const requestContext = getRequestContext();
      const envConfig = requestContext ? null : getConfig();
      const resolvedProjectId = project_id ?? requestContext?.defaultProjectId ?? envConfig?.defaultProjectId;
    
      if (!resolvedProjectId) {
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: {
                  code: "MISSING_PROJECT_ID",
                  message:
                    "project_id is required. Either provide it in the request or set TC_DEFAULT_PROJECT.",
                },
              }),
            },
          ],
        };
      }
    
      try {
        const client = getApiClient();
        const existingRaw = await client.getTestCaseRaw(id, resolvedProjectId, {
          parseRs: parse_reusable_steps ?? true,
        });
        const existing = unwrapApiEntity(existingRaw);
    
        if (!existing) {
          return {
            content: [
              {
                type: "text",
                text: JSON.stringify({
                  error: {
                    code: "INVALID_TEST_CASE",
                    message: `Unable to load test case ${id}.`,
                  },
                }),
              },
            ],
          };
        }
    
        const stepsSource = getExistingStepsSource(existing);
        const steps = stepsSource?.map((s, index) => ({
          step_number: getStepNumber(s, index),
          step: getStepText(s) ?? "",
          expected_result: getStepExpectedResult(s) ?? null,
          reusable_step_id: getStepReusableId(s) ?? null,
        }));
    
        const stepsMissingExpectedResults = (steps ?? [])
          .filter((step) => !normalizeString(step.expected_result))
          .map((step) => step.step_number);
    
        const suiteValue = getField<unknown>(existing, "suite");
        const projectValue = getField<unknown>(existing, "project");
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(
                {
                  success: true,
                  testCase: {
                    id: extractId(existing) ?? id,
                    title: getField<string>(existing, "title"),
                    description: getField<string | null>(existing, "description"),
                    priority: toNumberId(getField<unknown>(existing, "priority")),
                    suite: typeof suiteValue === "object" ? extractId(suiteValue) : suiteValue,
                    suiteTitle:
                      getField<string>(existing, "suite_title") ??
                      (suiteValue && typeof suiteValue === "object"
                        ? getField<string>(suiteValue, "title")
                        : undefined),
                    project:
                      typeof projectValue === "object"
                        ? extractId(projectValue)
                        : projectValue,
                    projectTitle:
                      projectValue && typeof projectValue === "object"
                        ? getField<string>(projectValue, "title")
                        : undefined,
                    steps,
                  },
                  stepsMissingExpectedResults,
                },
                null,
                2
              ),
            },
          ],
        };
      } catch (error) {
        const message = error instanceof Error ? error.message : "Unknown error";
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify({
                error: {
                  code: "API_ERROR",
                  message: message,
                },
              }),
            },
          ],
        };
      }
    }
  • Zod schema definition for the inputs required by the get_test_case tool.
    export const getTestCaseSchema = z.object({
      id: z.number().describe("Test case ID to retrieve (required)"),
      project_id: z
        .number()
        .optional()
        .describe("Project ID (uses default if not specified)"),
      parse_reusable_steps: z
        .boolean()
        .optional()
        .describe("Parse reusable steps into full steps (default: true)"),
    });
  • Registration definition for the get_test_case tool, including its name, description, and input schema.
    export const getTestCaseTool = {
      name: "get_test_case",
      description: `Fetch a single test case with full details, including steps and expected results.
    
    Required: id (test case ID)
    Optional: project_id, parse_reusable_steps (default: true)
    
    Example:
    {
      "id": 1835,
      "parse_reusable_steps": true
    }`,
    
      inputSchema: {
        type: "object" as const,
        properties: {
          id: {
            type: "number",
            description: "Test case ID to retrieve (required)",
          },
          project_id: {
            type: "number",
            description: "Project ID (optional if default is set)",
          },
          parse_reusable_steps: {
            type: "boolean",
            description: "Parse reusable steps into full steps (default: true)",
          },
        },
        required: ["id"],
      },
    };
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses return content ('full details, including steps and expected results') but omits safety profile (read-only status), error handling (e.g., 'not found' behavior), or authentication requirements.

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?

The description is efficiently structured with the purpose front-loaded in the first sentence, followed by parameter requirements and a concrete example. Every sentence earns its place; no redundancy or fluff.

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?

Given the absence of an output schema, the description appropriately compensates by describing the return payload ('full details, including steps'). For a simple three-parameter read operation with complete schema coverage, this is sufficient, though mentioning error cases would improve completeness.

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

Parameters3/5

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

Schema description coverage is 100%, establishing a baseline of 3. The description adds an example JSON and explicitly labels required vs optional parameters, though this largely duplicates the schema's required array and property descriptions without adding semantic depth like format constraints or value examples.

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?

The description opens with a specific verb ('Fetch'), identifies the resource ('single test case'), and specifies the scope ('full details, including steps and expected results'). This clearly distinguishes it from siblings like list_test_cases (plural/bulk) and update_test_case (mutation).

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?

The phrase 'Fetch a single test case' provides clear context that this tool is for retrieving a specific item by ID, implicitly contrasting with list_test_cases. However, it lacks explicit 'when not to use' guidance or named alternatives for search scenarios.

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/TCSoftInc/testcollab-mcp-server'

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