list_project_issues
Retrieve and display a list of project issues from Redmine, filtered by status and limited to a specified number, presented in a table format for easy review and management.
Instructions
列出專案的議題
Args:
project_id: 專案 ID
status_filter: 狀態篩選 ("open", "closed", "all")
limit: 最大回傳數量 (預設 20,最大 100)
Returns:
專案議題列表,以表格格式呈現
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| project_id | Yes | ||
| status_filter | No | open |
Input Schema (JSON Schema)
{
"properties": {
"limit": {
"default": 20,
"title": "Limit",
"type": "integer"
},
"project_id": {
"title": "Project Id",
"type": "integer"
},
"status_filter": {
"default": "open",
"title": "Status Filter",
"type": "string"
}
},
"required": [
"project_id"
],
"title": "list_project_issuesArguments",
"type": "object"
}
Implementation Reference
- src/redmine_mcp/server.py:189-257 (handler)The handler function decorated with @mcp.tool(), which both implements the tool logic and registers it with the FastMCP server. It fetches issues from a Redmine project using the Redmine client, applies status and limit filters, formats them into a readable table, and handles errors.@mcp.tool() def list_project_issues(project_id: int, status_filter: str = "open", limit: int = 20) -> str: """ 列出專案的議題 Args: project_id: 專案 ID status_filter: 狀態篩選 ("open", "closed", "all") limit: 最大回傳數量 (預設 20,最大 100) Returns: 專案議題列表,以表格格式呈現 """ try: client = get_client() # 限制 limit 範圍 limit = min(max(limit, 1), 100) # 根據狀態篩選設定參數 params = { 'project_id': project_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' 表示關閉狀態 # "all" 則不設定 status_id # 取得議題列表 issues = client.list_issues(**params) if not issues: return f"專案 {project_id} 中沒有找到符合條件的議題" # 取得專案資訊 try: project = client.get_project(project_id) project_name = project.name except: project_name = f"專案 {project_id}" # 格式化議題列表 result = f"""專案: {project_name} 狀態篩選: {status_filter} 找到 {len(issues)} 個議題: {"ID":<8} {"標題":<40} {"狀態":<12} {"指派給":<15} {"更新時間":<10} {"-"*8} {"-"*40} {"-"*12} {"-"*15} {"-"*10}""" for issue in issues: title = issue.subject[:37] + "..." if len(issue.subject) > 40 else issue.subject status = issue.status.get('name', 'N/A')[:10] assignee = issue.assigned_to.get('name', '未指派')[:13] if issue.assigned_to else '未指派' updated = issue.updated_on[:10] if issue.updated_on else 'N/A' result += f"\n{issue.id:<8} {title:<40} {status:<12} {assignee:<15} {updated:<10}" return result except RedmineAPIError as e: return f"列出專案議題失敗: {str(e)}" except Exception as e: return f"系統錯誤: {str(e)}"