get_priorities
Retrieve all available test case priorities, including their IDs and names, for use when creating or updating test cases.
Instructions
Get all available test case priorities (e.g. Critical, High, Medium, Low). Returns priority IDs and names that can be used when creating or updating test cases.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get_priorities.ts:7-17 (handler)The handler function for the get_priorities tool. Calls client.getPriorities() and maps results through PrioritySchema for validation.
export const getPrioritiesTool: ToolDefinition<typeof parameters, TestRailClient> = { name: "get_priorities", description: "Get all available test case priorities (e.g. Critical, High, Medium, Low). Returns priority IDs and names that can be used when creating or updating test cases.", parameters, handler: async (_args: any, client: TestRailClient) => { const priorities = await client.getPriorities(); return { priorities: priorities.map(p => PrioritySchema.parse(p)), }; }, }; - src/types/testrail.ts:67-71 (schema)Zod schema defining the Priority type with id (number), is_default (boolean), and name (string).
export const PrioritySchema = z.object({ id: z.number(), is_default: z.boolean(), name: z.string(), }); - src/index.ts:87-115 (registration)Registration loop in index.ts where getPrioritiesTool (in the tools array at line 70) is registered with the MCP server via server.registerTool.
for (const tool of tools) { server.registerTool( tool.name, { description: tool.description, inputSchema: tool.parameters, }, async (args: any) => { try { const output: Record<string, any> = await tool.handler(args, client); const sanitized = removeNullish(output); return { content: [ { type: "text" as const, text: JSON.stringify(sanitized), }, ], } as any; } catch (error: any) { return { content: [{ type: "text", text: `Error: ${error.message}` }], isError: true, }; } } ); } - src/client/testrail.ts:95-100 (helper)Client method that fetches priorities from TestRail API via GET /api/v2/get_priorities, with caching via prioritiesPromise.
async getPriorities(): Promise<Priority[]> { if (!this.prioritiesPromise) { this.prioritiesPromise = this.get<Priority[]>(`${API_BASE_V2}/get_priorities`); } return this.prioritiesPromise; }