get_project_components
Retrieve all components for a Jira project to organize and manage issue categorization effectively.
Instructions
Get all available components for a Jira project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectKey | Yes | The project key (e.g., "TSSE") |
Implementation Reference
- src/jira-client.ts:221-233 (handler)The core handler function that fetches and maps project components from the Jira API endpoint `/project/${projectKey}/components`.export async function getProjectComponents(projectKey: string): Promise<ProjectComponent[]> { const response = await jiraFetch<Array<{ id: string; name: string; description?: string; }>>(`/project/${projectKey}/components`); return response.map((c) => ({ id: c.id, name: c.name, description: c.description, })); }
- src/jira-client.ts:210-214 (schema)Type definition for ProjectComponent used in the tool's output.export interface ProjectComponent { id: string; name: string; description?: string; }
- src/index.ts:419-461 (registration)MCP server tool registration, including Zod input/output schemas, title, description, and thin wrapper handler that validates input and calls the core getProjectComponents function.server.registerTool( 'get_project_components', { title: 'Get Project Components', description: 'Get all available components for a Jira project', inputSchema: { projectKey: z.string().describe('The project key (e.g., "TSSE")'), }, outputSchema: { components: z.array(z.object({ id: z.string(), name: z.string(), description: z.string().optional(), })).optional(), error: z.object({ message: z.string(), statusCode: z.number().optional(), details: z.unknown().optional(), }).optional(), }, }, async ({ projectKey }) => { try { if (!projectKey || !projectKey.trim()) { throw new Error('projectKey is required'); } const components = await getProjectComponents(projectKey); const output = { components }; return { content: [{ type: 'text', text: JSON.stringify(output, null, 2) }], structuredContent: output, }; } catch (error) { const errOutput = formatError(error); return { content: [{ type: 'text', text: JSON.stringify(errOutput, null, 2) }], structuredContent: errOutput, isError: true, }; } } );