Skip to main content
Glama

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
NameRequiredDescriptionDefault
projectKeyYesThe project key (e.g., "TSSE")

Implementation Reference

  • 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,
      }));
    }
  • 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,
          };
        }
      }
    );

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/eh24905-wiz/jira-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server