Skip to main content
Glama
TCSoftInc

TestCollab MCP Server

by TCSoftInc

reorder_suites

Organize test suites by setting their sort order under a specified parent suite or at the root level to maintain structured testing workflows.

Instructions

Set the sort order of sibling suites under a given parent. Tip: Call get_project_context or list_suites first to see current suite IDs and order.

Required: parent (parent suite ID, title, or null for root), suite_ids (ordered array of suite IDs) Optional: project_id

Example - reorder root-level suites: { "parent": null, "suite_ids": [5, 3, 8, 1] }

Example - reorder children of "Authentication": { "parent": "Authentication", "suite_ids": [12, 10, 15] }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNoProject ID (optional if TC_DEFAULT_PROJECT is set)
parentYesParent suite ID, title, or null for root-level suites (required)
suite_idsYesOrdered array of suite IDs representing the desired sort order (required)

Implementation Reference

  • The handler function that executes the `reorder_suites` tool. It resolves the project and parent suite, calls the API client to update the suite order, and clears the cache.
    export async function handleReorderSuites(args: {
      project_id?: number;
      parent: number | string | null;
      suite_ids: number[];
    }): Promise<{ content: Array<{ type: "text"; text: string }> }> {
      try {
        const projectId = resolveProjectId(args.project_id);
        if (!projectId) {
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify({
                  error: {
                    code: "MISSING_PROJECT_ID",
                    message:
                      "No project_id provided and no default project configured. Set TC_DEFAULT_PROJECT or pass project_id.",
                  },
                }),
              },
            ],
          };
        }
    
        // Resolve parent
        let parentId: number | null = null;
        if (args.parent !== null) {
          if (typeof args.parent === "number") {
            parentId = args.parent;
          } else {
            const resolved = resolveSuiteByTitle(args.parent, projectId);
            if (resolved === null) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: JSON.stringify({
                      error: {
                        code: "PARENT_SUITE_NOT_FOUND",
                        message: `Could not find parent suite with title "${args.parent}". Call get_project_context to see available suites.`,
                      },
                    }),
                  },
                ],
              };
            }
            parentId = resolved;
          }
        }
    
        const client = getApiClient();
        const result = await client.setSuiteOrder({
          projectId,
          parentId,
          suiteIds: args.suite_ids,
        });
    
        // Invalidate project context cache
        clearProjectContextCache();
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                parent_id: parentId,
                order: args.suite_ids,
                result,
              }),
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                error: {
                  code: "REORDER_SUITES_FAILED",
                  message:
                    error instanceof Error ? error.message : "Unknown error",
                },
              }),
            },
          ],
        };
      }
    }
  • Zod schema definition for validating the input arguments for the `reorder_suites` tool.
    export const reorderSuitesSchema = z.object({
      project_id: z
        .number()
        .optional()
        .describe("Project ID (optional if TC_DEFAULT_PROJECT is set)"),
      parent: z
        .union([z.number(), z.string(), z.null()])
        .describe(
          "Parent suite ID, title, or null for root-level suites (required)"
        ),
      suite_ids: z
        .array(z.number())
        .min(1)
        .describe(
          "Ordered array of suite IDs representing the desired sort order (required)"
        ),
    });
  • Tool definition containing the name and description for the `reorder_suites` tool.
    export const reorderSuitesTool = {
      name: "reorder_suites",
      description: `Set the sort order of sibling suites under a given parent.
    Tip: Call get_project_context or list_suites first to see current suite IDs and order.
    
    Required: parent (parent suite ID, title, or null for root), suite_ids (ordered array of suite IDs)
    Optional: project_id
    
    Example - reorder root-level suites:
    { "parent": null, "suite_ids": [5, 3, 8, 1] }
    
    Example - reorder children of "Authentication":
    { "parent": "Authentication", "suite_ids": [12, 10, 15] }`,
    };
  • Helper function to resolve a suite ID from its title by searching the project context tree.
    function resolveSuiteByTitle(
      title: string,
      projectId: number
    ): number | null {
      const context = getCachedProjectContext(projectId);
      if (!context) return null;
    
      const search = (
        nodes: Array<{ id: number; title: string; children: unknown[] }>
      ): number | null => {
        for (const node of nodes) {
          if (node.title.toLowerCase() === title.toLowerCase()) {
            return node.id;
          }
          const childResult = search(
            node.children as Array<{ id: number; title: string; children: unknown[] }>
          );
          if (childResult !== null) return childResult;
        }
        return null;
      };
    
      return search(context.suites as Array<{ id: number; title: string; children: unknown[] }>);
    }
Behavior3/5

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

With no annotations provided, the description carries full burden. It explains the core operation (setting order) and implies atomic replacement via the examples, but fails to disclose error behaviors (e.g., what happens if suite_ids omits existing siblings), permission requirements, or whether the operation is reversible. Adequate but lacks safety/risk disclosure for a mutation tool.

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?

Excellent structure: single-sentence purpose, prerequisite tip, required/optional parameter summary, and two targeted examples. Every element earns its place. The examples are compact yet demonstrate both root-level and nested usage patterns without verbosity.

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 100% schema coverage and lack of output schema, the description provides sufficient context for invocation. It covers prerequisites, parameter semantics via examples, and operation scope. Minor deduction for not describing return values or error states, though no output schema exists to mandate this.

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 coverage is 100%, establishing a baseline of 3. The description adds substantial value through concrete JSON examples demonstrating that 'parent' accepts null for root and string titles (like 'Authentication') rather than just IDs, and showing the exact array format expected for suite_ids. This practical context aids correct invocation beyond schema definitions.

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 the specific action 'Set the sort order of sibling suites under a given parent,' clearly defining the verb (set), resource (sort order), and scope (sibling suites under parent). This effectively distinguishes it from sibling tools like move_suite (which changes parentage) and update_suite (which modifies properties).

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 explicit prerequisite guidance: 'Tip: Call get_project_context or list_suites first to see current suite IDs and order.' This establishes when to use prerequisites. However, it lacks explicit 'when not to use' guidance comparing it to move_suite, though the 'sibling suites' phrasing provides implicit distinction.

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