list-projects
Retrieve all QA Studio projects to manage test cases and track testing progress, with optional search to filter by project name.
Instructions
List all projects in QA Studio
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search | No | Optional search query to filter projects by name |
Implementation Reference
- src/index.ts:49-83 (registration)Full registration of the 'list-projects' tool, including name, schema, description, and inline handler function that fetches projects from the QA Studio API via apiRequest helper, handles optional search query, and returns JSON-formatted list or error message.// Register tool: list-projects server.registerTool( 'list-projects', { description: 'List all projects in QA Studio', inputSchema: { search: z.string().optional().describe('Optional search query to filter projects by name') } }, async (args) => { try { const { search } = args; const query = search ? `?search=${encodeURIComponent(search)}` : ''; const data = await apiRequest(`/projects${query}`); 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 }; } } );
- src/index.ts:58-82 (handler)The core handler function for 'list-projects' tool. Extracts optional 'search' param, constructs API query, calls apiRequest to /projects endpoint, returns pretty-printed JSON of projects or error response.async (args) => { try { const { search } = args; const query = search ? `?search=${encodeURIComponent(search)}` : ''; const data = await apiRequest(`/projects${query}`); 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 }; } }
- src/index.ts:52-56 (schema)Input schema using Zod for validation: optional 'search' string parameter to filter projects by name.{ description: 'List all projects in QA Studio', inputSchema: { search: z.string().optional().describe('Optional search query to filter projects by name') }
- src/index.ts:17-34 (helper)Shared helper function used by the list-projects handler (and other tools) to make authenticated API requests to 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(); }