Skip to main content
Glama
snowild

Redmine MCP Server

by snowild

get_my_issues

Retrieve issues assigned to you in Redmine projects. Filter by status (open, closed, all) and set result limits to manage your workload effectively.

Instructions

取得指派給我的議題列表

Args:
    status_filter: 狀態篩選 ("open", "closed", "all")
    limit: 最大回傳數量 (預設 20,最大 100)

Returns:
    我的議題列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
status_filterNoopen
limitNo

Implementation Reference

  • The handler function for the 'get_my_issues' MCP tool. It retrieves issues assigned to the current user from Redmine, filters by status, limits the results, and formats them into a readable table.
    @mcp.tool()
    def get_my_issues(status_filter: str = "open", limit: int = 20) -> str:
        """
        取得指派給我的議題列表
        
        Args:
            status_filter: 狀態篩選 ("open", "closed", "all")
            limit: 最大回傳數量 (預設 20,最大 100)
        
        Returns:
            我的議題列表
        """
        try:
            client = get_client()
            
            # 先取得當前用戶資訊
            current_user = client.get_current_user()
            user_id = current_user['id']
            user_name = current_user.get('firstname', '') + ' ' + current_user.get('lastname', '')
            
            # 限制 limit 範圍
            limit = min(max(limit, 1), 100)
            
            # 設定查詢參數
            params = {
                'assigned_to_id': user_id,
                'limit': limit,
                'sort': 'updated_on:desc'
            }
            
            # 處理狀態篩選
            if status_filter == "open":
                params['status_id'] = 'o'  # Redmine API 使用 'o' 表示開放狀態
            elif status_filter == "closed":
                params['status_id'] = 'c'  # Redmine API 使用 'c' 表示關閉狀態
            
            # 取得議題列表
            issues = client.list_issues(**params)
            
            if not issues:
                return f"沒有找到指派給 {user_name.strip()} 的{status_filter}議題"
            
            # 格式化結果
            result = f"""指派給 {user_name.strip()} 的議題:
    狀態篩選: {status_filter}
    找到 {len(issues)} 個議題:
    
    {"ID":<8} {"標題":<35} {"專案":<15} {"狀態":<12} {"更新時間":<10}
    {"-"*8} {"-"*35} {"-"*15} {"-"*12} {"-"*10}"""
    
            for issue in issues:
                title = issue.subject[:32] + "..." if len(issue.subject) > 35 else issue.subject
                project_name = issue.project.get('name', 'N/A')[:13]
                status = issue.status.get('name', 'N/A')[:10]
                updated = issue.updated_on[:10] if issue.updated_on else 'N/A'
                
                result += f"\n{issue.id:<8} {title:<35} {project_name:<15} {status:<12} {updated:<10}"
            
            return result
            
        except RedmineAPIError as e:
            return f"取得我的議題失敗: {str(e)}"
        except Exception as e:
            return f"系統錯誤: {str(e)}"

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/snowild/redmine-mcp'

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