Skip to main content
Glama

enrich_issue

Automatically enhance GitHub issues by adding labels, priority, type, complexity, and effort estimates using AI analysis.

Instructions

AI-powered issue enrichment. Automatically adds labels, priority, type, complexity, and effort estimates.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdYes
issueIdYes
issueNumberYes
issueTitleYes
issueDescriptionNo
projectContextNo
autoApplyNo

Implementation Reference

  • Handler function that processes 'enrich_issue' tool calls, delegates to IssueEnrichmentService, and optionally auto-applies changes
    private async handleEnrichIssue(args: any): Promise<any> { try { const enrichment = await this.enrichmentService.enrichIssue({ projectId: args.projectId, issueId: args.issueId, issueTitle: args.issueTitle, issueDescription: args.issueDescription, projectContext: args.projectContext }); if (args.autoApply) { await this.enrichmentService.applyEnrichment({ projectId: args.projectId, issueNumber: args.issueNumber, enrichment, applyLabels: true }); } return { success: true, enrichment }; } catch (error) { this.logger.error("Failed to enrich issue:", error); throw new McpError( ErrorCode.InternalError, `Failed to enrich issue: ${error instanceof Error ? error.message : 'Unknown error'}` ); } }
  • Switch case dispatcher for 'enrich_issue' tool in main executeToolHandler
    case "enrich_issue": return await this.handleEnrichIssue(args);
  • Tool definition including name, description, input schema, and examples for 'enrich_issue'
    export const enrichIssueTool: ToolDefinition<EnrichIssueArgs> = { name: "enrich_issue", description: "AI-powered issue enrichment. Automatically adds labels, priority, type, complexity, and effort estimates.", schema: enrichIssueSchema as unknown as ToolSchema<EnrichIssueArgs>, examples: [ { name: "Enrich issue", description: "Add tags and metadata to an issue", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH", issueId: "I_kwDOJrIzLs5eGXAT", issueNumber: 42, issueTitle: "Add user authentication", issueDescription: "Implement OAuth 2.0 authentication", autoApply: true } } ] };
  • Zod input schema validation for 'enrich_issue' tool parameters
    export const enrichIssueSchema = z.object({ projectId: z.string().min(1, "Project ID is required"), issueId: z.string().min(1, "Issue ID is required"), issueNumber: z.number().int().positive(), issueTitle: z.string().min(1, "Issue title is required"), issueDescription: z.string().optional(), projectContext: z.string().optional(), autoApply: z.boolean().default(false).optional() }); export type EnrichIssueArgs = z.infer<typeof enrichIssueSchema>;
  • Registers the 'enrichIssueTool' in the central ToolRegistry singleton
    this.registerTool(enrichIssueTool);
  • Core enrichment logic using AI to analyze issue and suggest labels, priority, type, complexity, effort, etc.
    async enrichIssue(params: { projectId: string; issueId: string; issueTitle: string; issueDescription?: string; projectContext?: string; existingLabels?: string[]; milestones?: Array<{ title: string; description: string }>; }): Promise<IssueEnrichmentResult> { try { this.logger.info(`Enriching issue: ${params.issueTitle}`); const model = this.aiFactory.getModel('main') || this.aiFactory.getBestAvailableModel(); if (!model) { throw new Error('AI service is not available'); } const prompt = `You are an expert project manager. Analyze this issue and provide enrichment as JSON: {"suggestedLabels":[],"suggestedPriority":"medium","suggestedType":"task","complexity":"moderate","estimatedEffort":"2 hours","relatedIssues":[],"reasoning":"..."}`; const response = await generateText({ model, prompt: `${prompt}\n\nIssue: ${params.issueTitle}\nDescription: ${params.issueDescription || 'None'}`, temperature: 0.5, maxTokens: 1000 }); const jsonMatch = response.text.match(/\{[\s\S]*\}/); if (!jsonMatch) { throw new Error('Failed to parse AI response'); } const enrichment = JSON.parse(jsonMatch[0]); return { issueId: params.issueId, ...enrichment }; } catch (error) { this.logger.error(`Failed to enrich issue ${params.issueId}`, error); throw error; } }

Other Tools

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/kunwarVivek/mcp-github-project-manager'

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