Skip to main content
Glama
snowild

Redmine MCP Server

by snowild

get_document_categories

Retrieve available document categories from Redmine to organize and classify project files effectively.

Instructions

取得所有可用的文件分類列表

Returns:
    格式化的文件分類列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function for 'get_document_categories'. Decorated with @mcp.tool() for automatic registration. Fetches categories via Redmine client and formats as a formatted table string.
    @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)}"
  • Helper method in RedmineClient class that queries the Redmine API for document categories enumeration.
    def get_document_categories(self) -> List[Dict[str, Any]]:
        """取得文件分類列表"""
        response = self._make_request('GET', '/enumerations/document_categories.json')
        return response.get('document_categories', [])
  • The @mcp.tool() decorator registers the get_document_categories function as an MCP tool.
    @mcp.tool()

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