get_priorities
Retrieve a formatted list of all available issue priorities to streamline task management within the Redmine project management system using the MCP server.
Instructions
取得所有可用的議題優先級列表
Returns:
格式化的優先級列表
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "get_prioritiesArguments",
"type": "object"
}
Implementation Reference
- src/redmine_mcp/server.py:321-350 (handler)MCP tool handler for get_priorities: fetches priorities from Redmine client and formats them as a table string. Registered via @mcp.tool() decorator.@mcp.tool() def get_priorities() -> str: """ 取得所有可用的議題優先級列表 Returns: 格式化的優先級列表 """ try: client = get_client() priorities = client.get_priorities() if not priorities: return "沒有找到議題優先級" result = "可用的議題優先級:\n\n" result += f"{'ID':<5} {'名稱':<15} {'預設':<8}\n" result += f"{'-'*5} {'-'*15} {'-'*8}\n" for priority in priorities: is_default = "是" if priority.get('is_default', False) else "否" result += f"{priority['id']:<5} {priority['name']:<15} {is_default:<8}\n" return result except RedmineAPIError as e: return f"取得議題優先級失敗: {str(e)}" except Exception as e: return f"系統錯誤: {str(e)}"
- RedmineClient method that makes the actual API call to retrieve the list of issue priorities from Redmine.def get_priorities(self) -> List[Dict[str, Any]]: """取得優先級列表""" response = self._make_request('GET', '/enumerations/issue_priorities.json') return response.get('issue_priorities', [])
- Helper method to find priority ID by name using cache.def find_priority_id_by_name(self, name: str) -> Optional[int]: """根據優先權名稱找到對應的 ID""" cache = self._load_enum_cache() return cache.get('priorities', {}).get(name)
- Helper method to get all available priorities as name-to-ID mapping from cache."""取得所有可用的優先權選項(名稱到ID的對應)""" cache = self._load_enum_cache() return cache.get('priorities', {})