Skip to main content
Glama
snowild

Redmine MCP Server

by snowild

list_users

Retrieve and filter user accounts from Redmine project management system. Specify user status and limit results to manage access and permissions effectively.

Instructions

列出所有用戶

Args:
    limit: 最大回傳數量 (預設 20,最大 100)
    status_filter: 狀態篩選 ("active", "locked", "all")

Returns:
    用戶列表,以表格格式呈現

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
status_filterNoactive

Implementation Reference

  • MCP tool handler for 'list_users': fetches users from RedmineClient, filters by status, formats output as a table string.
    @mcp.tool()
    def list_users(limit: int = 20, status_filter: str = "active") -> str:
        """
        列出所有用戶
        
        Args:
            limit: 最大回傳數量 (預設 20,最大 100)
            status_filter: 狀態篩選 ("active", "locked", "all")
        
        Returns:
            用戶列表,以表格格式呈現
        """
        try:
            client = get_client()
            limit = min(max(limit, 1), 100)
            
            # 轉換狀態篩選
            status = None
            if status_filter == "active":
                status = 1
            elif status_filter == "locked":
                status = 3
            
            users = client.list_users(limit=limit, status=status)
            
            if not users:
                return "沒有找到用戶"
            
            result = f"找到 {len(users)} 個用戶:\n\n"
            result += f"{'ID':<5} {'登入名':<15} {'姓名':<20} {'Email':<25} {'狀態':<8}\n"
            result += f"{'-'*5} {'-'*15} {'-'*20} {'-'*25} {'-'*8}\n"
            
            for user in users:
                full_name = f"{user.firstname} {user.lastname}".strip()
                if not full_name:
                    full_name = user.login
                status_text = "啟用" if user.status == 1 else "停用"
                email = user.mail[:22] + "..." if len(user.mail) > 25 else user.mail
                result += f"{user.id:<5} {user.login:<15} {full_name:<20} {email:<25} {status_text:<8}\n"
            
            return result
            
        except RedmineAPIError as e:
            return f"取得用戶列表失敗: {str(e)}"
        except Exception as e:
            return f"系統錯誤: {str(e)}"
  • RedmineClient helper method that queries the Redmine /users.json API, parses raw user data into typed RedmineUser objects.
    def list_users(self, limit: int = 20, offset: int = 0, status: int = None) -> List[RedmineUser]:
        """列出用戶"""
        params = {
            'limit': min(max(limit, 1), 100),
            'offset': max(offset, 0)
        }
        
        if status is not None:
            params['status'] = status
        
        response = self._make_request('GET', '/users.json', params=params)
        
        users = []
        for user_data in response.get('users', []):
            users.append(RedmineUser(
                id=user_data['id'],
                login=user_data['login'],
                firstname=user_data.get('firstname', ''),
                lastname=user_data.get('lastname', ''),
                mail=user_data.get('mail', ''),
                status=user_data.get('status', 1),
                created_on=user_data.get('created_on'),
                last_login_on=user_data.get('last_login_on')
            ))
        
        return users
  • Dataclass defining the structure for RedmineUser objects returned by list_users.
    class RedmineUser:
        """Redmine 用戶數據結構"""
        id: int
        login: str
        firstname: str
        lastname: str
        mail: str
        status: int
        created_on: Optional[str] = None
        last_login_on: Optional[str] = None
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds some context: it mentions the return format ('以表格格式呈現' - in table format) and default/max values for parameters. However, it lacks details on permissions, rate limits, pagination, or error handling, which are important for a list operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured and concise, with clear sections for purpose, arguments, and returns. Each sentence earns its place by providing essential information without redundancy, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (2 parameters, no annotations, no output schema), the description is partially complete. It covers parameters well and hints at the return format, but lacks details on output structure (e.g., fields in the table), error cases, or integration with siblings, leaving gaps for the agent to infer.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, so the description fully compensates by explaining both parameters: 'limit' (maximum return count, default 20, max 100) and 'status_filter' (status filtering options: 'active', 'locked', 'all'). This adds crucial meaning beyond the bare schema, making it easy for an agent to understand how to use them.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as '列出所有用戶' (list all users), which is a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_user' (singular) or 'search_users', leaving room for confusion about when to use this versus those alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_user' or 'search_users'. While it implies listing all users, it doesn't specify scenarios (e.g., bulk retrieval vs. specific lookups) or prerequisites, leaving the agent to guess based on context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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