- 
                Notifications
    
You must be signed in to change notification settings  - Fork 14
 
EPMRPP-109097 || MCP. Tools. Add tool get defect types by project #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
          
 Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Summary by CodeRabbitNew Features
 WalkthroughAdds a new MCP tool on TestItemResources named  Changes
 Sequence Diagram(s)sequenceDiagram
  participant User
  participant MCP as MCP Server
  participant TestItems as TestItemResources
  participant RP as ReportPortal Client
  User->>MCP: invoke get_project_defect_types (with project)
  MCP->>TestItems: call handler (toolGetProjectDefectTypes)
  TestItems->>RP: ProjectAPI.GetProject(project).Execute()
  alt success
    RP-->>TestItems: project data (JSON)
    TestItems-->>MCP: serialized response body
    MCP-->>User: 200 + JSON
  else error
    RP-->>TestItems: API error
    TestItems-->>MCP: mapped tool error
    MCP-->>User: error response
  end
    Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 
 Poem
 Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
 ✅ Passed checks (1 passed)
 ✨ Finishing touches
 🧪 Generate unit tests (beta)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment   | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new MCP tool to retrieve defect types for a specific project in Report Portal. The implementation follows the existing pattern used for other test item-related tools.
Key changes:
- Added 
toolGetProjectDefectTypes()method to fetch defect types via the Project API - Registered the new tool in the server initialization
 
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description | 
|---|---|
| internal/reportportal/server.go | Registers the new defect types tool in the server | 
| internal/reportportal/items.go | Implements the tool to fetch project defect types via Project API | 
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
aae4d14    to
    3b43335      
    Compare
  
    3b43335    to
    1e540ba      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
internal/reportportal/items.go(1 hunks)internal/reportportal/server.go(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.go
📄 CodeRabbit inference engine (README.md)
**/*.go: Go code must be formatted consistently; run the formatter (task fmt) on all Go source files
Go code should pass lint checks (task lint) before submission
When adding a new MCP tool, implement it as a method in the appropriate resource Go file returning (mcp.Tool, server.ToolHandlerFunc) and register it in NewServer via s.AddTool(...)
Files:
internal/reportportal/items.gointernal/reportportal/server.go
⚙️ CodeRabbit configuration file
Focus on Go best practices, error handling, concurrency safety, performance, and security. Check for proper resource cleanup and context handling.
Files:
internal/reportportal/items.gointernal/reportportal/server.go
internal/reportportal/**
⚙️ CodeRabbit configuration file
Pay special attention to API integration patterns, error handling, data validation, and MCP protocol compliance.
Files:
internal/reportportal/items.gointernal/reportportal/server.go
🔇 Additional comments (3)
internal/reportportal/items.go (2)
625-632: LGTM! Tool metadata follows established patterns.The tool registration correctly uses the project parameter, includes a helpful description that guides users to the
configuration/subtypespath, and integrates analytics appropriately.
633-636: LGTM! Proper parameter extraction and error handling.The project parameter extraction follows the established pattern with appropriate error handling.
internal/reportportal/server.go (1)
66-66: LGTM! Proper tool registration.The new tool is correctly registered following the established pattern, and its placement alongside other test item tools is appropriate.
Implement tool for getting the ReportPortal Defect Types configuration for specific project.