get_document_categories
Retrieve a formatted list of available document categories from the Redmine MCP Server to organize and manage project files effectively.
Instructions
取得所有可用的文件分類列表
Returns:
格式化的文件分類列表
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Input Schema (JSON Schema)
{
"properties": {},
"title": "get_document_categoriesArguments",
"type": "object"
}
Implementation Reference
- src/redmine_mcp/server.py:383-412 (handler)MCP tool handler for 'get_document_categories'. Decorated with @mcp.tool() for registration. Calls client.get_document_categories() and formats the response as a formatted string table listing categories with ID, name, and default status.@mcp.tool() def get_document_categories() -> str: """ 取得所有可用的文件分類列表 Returns: 格式化的文件分類列表 """ try: client = get_client() categories = client.get_document_categories() if not categories: return "沒有找到文件分類" result = "可用的文件分類:\n\n" result += f"{'ID':<5} {'名稱':<25} {'預設':<8}\n" result += f"{'-'*5} {'-'*25} {'-'*8}\n" for category in categories: is_default = "是" if category.get('is_default', False) else "否" result += f"{category['id']:<5} {category['name']:<25} {is_default:<8}\n" return result except RedmineAPIError as e: return f"取得文件分類失敗: {str(e)}" except Exception as e: return f"系統錯誤: {str(e)}"
- RedmineClient helper method that performs the actual API call to retrieve document categories from Redmine's /enumerations/document_categories.json endpoint.def get_document_categories(self) -> List[Dict[str, Any]]: """取得文件分類列表""" response = self._make_request('GET', '/enumerations/document_categories.json') return response.get('document_categories', [])