Skip to content

fix: Fix AttributeError issues in GitLab tools#18

Merged
Vijay-Duke merged 1 commit intomainfrom
fix/gitlab-tool-errors
Aug 12, 2025
Merged

fix: Fix AttributeError issues in GitLab tools#18
Vijay-Duke merged 1 commit intomainfrom
fix/gitlab-tool-errors

Conversation

@Vijay-Duke
Copy link
Copy Markdown
Owner

Summary

Fixes multiple AttributeError exceptions that were occurring when using various GitLab tools. The tool handlers were calling methods that didn't exist in the GitLabClient class.

Problem

The following tools were failing with AttributeError:

  1. gitlab_list_repository_tree - Handler was calling get_repository_tree() which didn't exist
  2. gitlab_list_commits - Handler exists but calls get_commits() (which exists from PR feat: Add commit and diff methods to GitLabClient #16)
  3. gitlab_search_in_project - Handler was calling search_in_project() which didn't exist
  4. gitlab_summarize_merge_request - Handler was calling summarize_merge_request() which didn't exist
  5. gitlab_batch_operations - Handler was calling batch_operations() which didn't exist
  6. gitlab_safe_preview_commit - Already fixed in PR feat: Add commit and diff methods to GitLabClient #16

Solution

Added the missing methods to GitLabClient:

1. get_repository_tree()

  • Lists files and directories in a repository
  • Supports recursive listing and ref specification
  • Returns structured tree data

2. search_in_project()

  • Searches within a project with various scopes (blobs, issues, commits, merge_requests, etc.)
  • Returns formatted results based on scope type
  • Includes pagination support

3. summarize_merge_request()

  • Generates AI-friendly summary of merge requests
  • Includes files changed, discussions, and key metrics
  • Limits output for LLM context efficiency

4. batch_operations()

  • Executes multiple operations in a single call
  • Supports stop-on-error mode
  • Returns detailed results for each operation

Changes

  • Added 4 new methods to GitLabClient class
  • All methods include:
    • Proper error handling with try-catch blocks
    • @retry_on_error() decorator for network resilience
    • Comprehensive docstrings
    • Type hints
    • Consistent return format

Testing

All existing tool handlers should now work without AttributeError exceptions. The methods follow the same patterns as existing GitLabClient methods for consistency.

Related Issues

This fixes the reported failures where tools were throwing AttributeError exceptions when trying to call non-existent methods.

Added the following missing methods to GitLabClient:
- get_repository_tree: List files and directories in repository
- search_in_project: Search within a project (blobs, issues, commits, etc.)
- summarize_merge_request: Generate AI-friendly MR summary
- batch_operations: Execute multiple operations in batch

These methods were being called by tool handlers but didn't exist,
causing AttributeError exceptions. The safe_preview_commit method
already exists from a previous PR.

Fixes:
- gitlab_list_repository_tree functionality
- gitlab_list_commits functionality (handler was calling get_commits)
- gitlab_search_in_project functionality
- gitlab_summarize_merge_request functionality
- gitlab_batch_operations functionality
@Vijay-Duke Vijay-Duke merged commit 17e1973 into main Aug 12, 2025
11 checks passed
@Vijay-Duke Vijay-Duke deleted the fix/gitlab-tool-errors branch August 12, 2025 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant