jira_get_statuses
Retrieve available issue statuses globally or per project, including categories and workflow details, by providing project key or issue type ID.
Instructions
Retrieves available statuses (global or project-specific, e.g., To Do, In Progress, Done). Returns status categories and workflow information.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectKey | No | Project key to get statuses for specific project | |
| issueTypeId | No | Issue type ID to get statuses for specific issue type |
Implementation Reference
- src/tools/get-statuses.ts:33-61 (handler)The main handler function handleGetStatuses that validates input, calls the API helper, and formats the response.
export async function handleGetStatuses(input: unknown): Promise<McpToolResponse> { try { const validated = validateInput(GetStatusesInputSchema, input); if (validated.projectKey && validated.issueTypeId) { log.info( `Getting statuses for project ${validated.projectKey} and issue type ${validated.issueTypeId}...` ); } else if (validated.projectKey) { log.info(`Getting statuses for project ${validated.projectKey}...`); } else { log.info('Getting global statuses...'); } const getParams: any = {}; if (validated.projectKey !== undefined) getParams.projectKey = validated.projectKey; if (validated.issueTypeId !== undefined) getParams.issueTypeId = validated.issueTypeId; const statuses = await getStatuses(getParams); log.info(`Found ${statuses.length} status(es)`); return formatStatusesResponse(statuses); } catch (error) { log.error('Error in handleGetStatuses:', error); return handleError(error); } } - src/types/tools.ts:165-177 (schema)Zod schema GetStatusesInputSchema defining optional projectKey and issueTypeId input parameters.
export const GetStatusesInputSchema = z.object({ projectKey: z .string() .optional() .describe('Project key to get statuses for specific project') .refine((v) => (v ? isValidProjectKey(v) : true), 'Invalid project key format'), issueTypeId: z .string() .optional() .describe('Issue type ID to get statuses for specific issue type'), }); export type GetStatusesInput = z.infer<typeof GetStatusesInputSchema>; - src/index.ts:115-121 (registration)Registration of the tool in the MCP server with name, schema, handler, and readOnlyHint annotation.
{ name: TOOL_NAMES.GET_STATUSES, description: tools.getStatusesTool.description!, inputSchema: GetStatusesInputSchema, handler: tools.handleGetStatuses, annotations: { readOnlyHint: true }, }, - src/utils/api-helpers.ts:520-553 (helper)The API helper function getStatuses that fetches statuses from Jira API, supporting project-level and global queries.
export async function getStatuses( options: { projectKey?: string; issueTypeId?: string; } = {} ): Promise<JiraStatus[]> { let url = '/status'; if (options.projectKey && options.issueTypeId) { url = `/project/${options.projectKey}/statuses`; } else if (options.projectKey) { url = `/project/${options.projectKey}/statuses`; } const config: AxiosRequestConfig = { method: 'GET', url, }; if (options.projectKey) { const response = await makeJiraRequest<Array<{ id?: string; name: string; statuses: JiraStatus[] }>>(config); if (options.issueTypeId) { const match = response.find( (issueType) => issueType.id === options.issueTypeId || issueType.name === options.issueTypeId ); if (match) return match.statuses; } // Flatten the statuses from all issue types return response.flatMap((issueType) => issueType.statuses); } return await makeJiraRequest<JiraStatus[]>(config); } - src/utils/formatters.ts:303-330 (helper)The formatter function formatStatusesResponse that formats Jira status data into a human-readable text response.
export function formatStatusesResponse(statuses: JiraStatus[]): McpToolResponse { if (statuses.length === 0) { return { content: [ { type: 'text', text: 'No statuses found.', }, ], }; } const statusesList = statuses .map( (status) => `• **${status.name}** (ID: ${status.id})\n ${status.description}\n Category: ${status.statusCategory.name} (${status.statusCategory.key})` ) .join('\n\n'); return { content: [ { type: 'text', text: `Found ${statuses.length} status(es):\n\n${statusesList}`, }, ], }; }