get_suites
Retrieve and filter test suites from the BugBug automation platform to manage and organize testing workflows.
Instructions
Get list of BugBug test suites
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_suites"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ordering | No | Sort order | |
| page | No | Page number for pagination | |
| pageSize | No | Number of results per page | |
| query | No | Search query for suite names |
Implementation Reference
- src/tools/suites.ts:7-62 (handler)The complete implementation of the 'get_suites' tool, including input schema, handler logic for fetching and formatting suites list from BugBug API.
export const getSuitesTool: Tool = { name: 'get_suites', title: 'Get list of BugBug test suites', description: 'Get list of BugBug test suites', inputSchema: z.object({ page: z.number().optional().describe('Page number for pagination'), pageSize: z.number().optional().describe('Number of results per page'), query: z.string().optional().describe('Search query for suite names'), ordering: z.enum(['name', '-name', 'created', '-created']).optional().describe('Sort order'), }).shape, handler: async ({ page, pageSize, query, ordering }) => { try { const response = await bugbugClient.getSuites(page, pageSize, query, ordering); if (response.status !== 200) { return { content: [ { type: 'text', text: `Error: ${response.status} ${response.statusText}`, }, ], }; } const { count, page: currentPage, results } = response.data; let suitesList = ''; if (results && results.length > 0) { suitesList = results.map((suite: BugBugSuite) => `- **${suite.name || 'Unnamed Suite'}** (ID: ${suite.id}) - ${suite.testsCount || 0} tests` ).join('\n'); } else { suitesList = 'No suites found.'; } return { content: [ { type: 'text', text: `**BugBug Test Suites** (Page ${currentPage || 1}, Total: ${count || 0}):\n\n${suitesList}`, }, ], }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching suites: ${error instanceof Error ? error.message : 'Unknown error'}`, }, ], }; } } }; - src/tools/index.ts:11-33 (registration)Registration of all tools, including 'get_suites' from suitesTools, using server.registerTool with name, schema, and handler.
export function registerAllTools(server: McpServer): void { const tools: Record<string, Tool> = { ...configTools, ...testsTools, ...testRunsTools, ...suitesTools, ...suiteRunsTools, ...profilesTools, ...advancedTools, }; for (const t in tools) { server.registerTool( tools[t].name, { description: tools[t].description, inputSchema: tools[t].inputSchema, annotations: { title: tools[t].title }, }, (args: unknown) => tools[t].handler(args as unknown) ); } } - src/tools/suites.ts:11-16 (schema)Zod input schema defining parameters for the get_suites tool: page, pageSize, query, ordering.
inputSchema: z.object({ page: z.number().optional().describe('Page number for pagination'), pageSize: z.number().optional().describe('Number of results per page'), query: z.string().optional().describe('Search query for suite names'), ordering: z.enum(['name', '-name', 'created', '-created']).optional().describe('Sort order'), }).shape, - src/services/bugbugClient.ts:155-164 (helper)Helper method bugbugClient.getSuites that constructs API query parameters and calls makeRequest to fetch suites from /suites/ endpoint.
async getSuites(page?: number, pageSize?: number, query?: string, ordering?: string): Promise<ApiResponse<PaginatedResponse<BugBugSuite>>> { const params = new URLSearchParams(); if (page) params.append('page', page.toString()); if (pageSize) params.append('page_size', pageSize.toString()); if (query) params.append('query', query); if (ordering) params.append('ordering', ordering); const queryString = params.toString() ? `?${params.toString()}` : ''; return this.makeRequest(`/suites/${queryString}`); }