get_project_components
Retrieve all components for a Jira project to organize and categorize issues 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)Core handler function that executes the tool logic by calling Jira API to fetch project componentsexport 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/index.ts:419-461 (registration)MCP tool registration including Zod input/output schemas and thin wrapper handler that calls the core implementationserver.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, }; } } );
- src/jira-client.ts:210-213 (schema)TypeScript interface defining the structure of a project component used by the handler and schemasexport interface ProjectComponent { id: string; name: string; description?: string;