get_statuses
Retrieve all available test statuses with IDs and names for use with add_result and get_tests.
Instructions
Get all available test statuses (e.g. Passed, Failed, Blocked). Returns status IDs and names that can be used with add_result and get_tests
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get_statuses.ts:12-17 (handler)The handler function that executes the get_statuses tool logic. Calls client.getStatuses() and maps results through StatusSchema validation.
handler: async (args: any, client: TestRailClient) => { const statuses = await client.getStatuses(); return { statuses: statuses.map(s => StatusSchema.parse(s)), }; }, - src/types/testrail.ts:117-121 (schema)Zod schema defining the status object shape with 'id', 'name', and 'label' fields.
export const StatusSchema = z.object({ id: z.number(), name: z.string(), label: z.string(), }); - src/index.ts:17-69 (registration)Import of the getStatusesTool definition.
import { getStatusesTool } from "./tools/get_statuses.js"; import { getPrioritiesTool } from "./tools/get_priorities.js"; import { getTestsTool } from "./tools/get_tests.js"; import { addResultsTool } from "./tools/add_results.js"; import { addAttachmentToRunTool } from "./tools/add_attachment_to_run.js"; import { addResultsForCasesTool } from "./tools/add_results_for_cases.js"; import { getLabelsTool } from "./tools/get_labels.js"; import { getSharedStepsTool } from "./tools/shared_steps/get_shared_steps.js"; import { getSharedStepTool } from "./tools/shared_steps/get_shared_step.js"; import { getSharedStepHistoryTool } from "./tools/shared_steps/get_shared_step_history.js"; import { addSharedStepTool } from "./tools/shared_steps/add_shared_step.js"; import { updateSharedStepTool } from "./tools/shared_steps/update_shared_step.js"; import { deleteSharedStepTool } from "./tools/shared_steps/delete_shared_step.js"; import { removeNullish } from "./utils/sanitizer.js"; import z from "zod"; const EnvSchema = z.object({ TESTRAIL_INSTANCE_URL: z.url('Must be a valid TestRail URL'), TESTRAIL_USERNAME: z.email('Must be a valid email address'), TESTRAIL_API_KEY: z.string().min(1, 'API key is required'), TESTRAIL_ENABLE_SHARED_STEPS: z.string().optional().transform(val => val === 'true') }); const parseResult = EnvSchema.safeParse(process.env); if (!parseResult.success) { console.error( "Invalid TestRail environment configuration:", JSON.stringify(z.treeifyError(parseResult.error), null, 2)); process.exit(1); } const { TESTRAIL_INSTANCE_URL, TESTRAIL_USERNAME, TESTRAIL_API_KEY, TESTRAIL_ENABLE_SHARED_STEPS } = parseResult.data; const server = new McpServer({ name: "TestRail MCP Server", version: "1.9.0", }); const client = new TestRailClient(TESTRAIL_INSTANCE_URL, TESTRAIL_USERNAME, TESTRAIL_API_KEY); const tools = [ getProjectsTool, getCaseTool, getCasesTool, getCaseFieldsTool, getTemplatesTool, getSectionsTool, updateCaseTool, updateCasesTool, addCaseTool, addRunTool, getStatusesTool, - src/index.ts:69-69 (registration)Tool added to the tools array for registration with the MCP server.
getStatusesTool, - src/index.ts:88-115 (registration)Generic MCP server registration loop that registers each tool (including get_statuses) by name, description, and input schema.
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, }; } } ); }