Skip to main content
Glama

list-test-runs

Retrieve test runs for a specific project in QA Studio, enabling users to view execution history, track progress, and manage testing workflows with pagination support.

Instructions

List test runs for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYesThe project ID to list test runs for
limitNoMaximum number of results to return (default: 50)
offsetNoNumber of results to skip for pagination (default: 0)

Implementation Reference

  • The handler function for the 'list-test-runs' tool. It destructures args for projectId, limit (default 50), offset (default 0), calls apiRequest to fetch test runs from the QA Studio API, returns JSON stringified data or error.
    async (args) => {
      try {
        const { projectId, limit = 50, offset = 0 } = args;
    
        const data = await apiRequest(`/runs?projectId=${projectId}&limit=${limit}&offset=${offset}`);
    
        return {
          content: [
            {
              type: 'text' as const,
              text: JSON.stringify(data, null, 2)
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: 'text' as const,
              text: `Error: ${error instanceof Error ? error.message : String(error)}`
            }
          ],
          isError: true
        };
      }
    }
  • The input schema for the 'list-test-runs' tool using Zod, requiring projectId and optional limit/offset for pagination.
    {
      description: 'List test runs for a project',
      inputSchema: {
        projectId: z.string().describe('The project ID to list test runs for'),
        limit: z.number().optional().describe('Maximum number of results to return (default: 50)'),
        offset: z
          .number()
          .optional()
          .describe('Number of results to skip for pagination (default: 0)')
      }
    },
  • src/index.ts:139-178 (registration)
    The full registration of the 'list-test-runs' tool via server.registerTool, specifying the tool name, input schema, and inline handler function.
    server.registerTool(
      'list-test-runs',
      {
        description: 'List test runs for a project',
        inputSchema: {
          projectId: z.string().describe('The project ID to list test runs for'),
          limit: z.number().optional().describe('Maximum number of results to return (default: 50)'),
          offset: z
            .number()
            .optional()
            .describe('Number of results to skip for pagination (default: 0)')
        }
      },
      async (args) => {
        try {
          const { projectId, limit = 50, offset = 0 } = args;
    
          const data = await apiRequest(`/runs?projectId=${projectId}&limit=${limit}&offset=${offset}`);
    
          return {
            content: [
              {
                type: 'text' as const,
                text: JSON.stringify(data, null, 2)
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: 'text' as const,
                text: `Error: ${error instanceof Error ? error.message : String(error)}`
              }
            ],
            isError: true
          };
        }
      }
    );
  • Shared apiRequest helper function used by the list-test-runs handler (and other tools) to perform authenticated API requests to the QA Studio backend.
    async function apiRequest(endpoint: string, options: RequestInit = {}): Promise<any> {
      const url = `${API_URL}${endpoint}`;
      const response = await fetch(url, {
        ...options,
        headers: {
          'Content-Type': 'application/json',
          'X-API-Key': API_KEY,
          ...options.headers
        }
      });
    
      if (!response.ok) {
        const error = await response.text();
        throw new Error(`API Error (${response.status}): ${error}`);
      }
    
      return response.json();
    }

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/QAStudio-Dev/mcp-server'

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