update_issue_status
Update the status of a Redmine issue by specifying either status ID or name, with optional notes to track changes.
Instructions
更新議題狀態
Args:
issue_id: 議題 ID
status_id: 新的狀態 ID(與 status_name 二選一)
status_name: 新的狀態名稱(與 status_id 二選一)
notes: 更新備註(可選)
Returns:
更新結果訊息
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| issue_id | Yes | ||
| status_id | No | ||
| status_name | No | ||
| notes | No |
Implementation Reference
- src/redmine_mcp/server.py:135-187 (handler)Implementation of the update_issue_status MCP tool. The @mcp.tool() decorator registers it with the FastMCP server. The function updates a Redmine issue's status using the Redmine client, supporting both status ID and name lookup, with optional notes. Includes error handling and confirmation of the update.@mcp.tool() def update_issue_status(issue_id: int, status_id: int = None, status_name: str = None, notes: str = "") -> str: """ 更新議題狀態 Args: issue_id: 議題 ID status_id: 新的狀態 ID(與 status_name 二選一) status_name: 新的狀態名稱(與 status_id 二選一) notes: 更新備註(可選) Returns: 更新結果訊息 """ try: client = get_client() # 處理狀態參數 final_status_id = status_id if status_name: final_status_id = client.find_status_id_by_name(status_name) if not final_status_id: return f"找不到狀態名稱:「{status_name}」\n\n可用狀態:\n" + "\n".join([f"- {name}" for name in client.get_available_statuses().keys()]) if not final_status_id: return "錯誤:必須提供 status_id 或 status_name 其中一個參數" # 準備更新資料 update_data = {'status_id': final_status_id} if notes.strip(): update_data['notes'] = notes.strip() # 執行更新 client.update_issue(issue_id, **update_data) # 取得更新後的議題資訊確認 updated_issue = client.get_issue(issue_id) result = f"""議題狀態更新成功! 議題: #{issue_id} - {updated_issue.subject} 新狀態: {updated_issue.status.get('name', 'N/A')}""" if notes.strip(): result += f"\n備註: {notes}" return result except RedmineAPIError as e: return f"更新議題狀態失敗: {str(e)}" except Exception as e: return f"系統錯誤: {str(e)}"