Skip to main content
Glama

list_users

Retrieve all user accounts from Splunk Enterprise/Cloud to manage access and permissions. Requires administrator privileges.

Instructions

List all Splunk users (requires admin privileges)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'list_users' MCP tool. It connects to Splunk, iterates over all users, extracts their details including roles and capabilities, and returns a list of user dictionaries. Registered via @mcp.tool() decorator.
    @mcp.tool()
    async def list_users() -> List[Dict[str, Any]]:
        """List all Splunk users (requires admin privileges)"""
        try:
            service = get_splunk_connection()
            logger.info("👥 Fetching Splunk users...")
                    
            users = []
            for user in service.users:
                try:
                    if hasattr(user, 'content'):
                        # Ensure roles is a list
                        roles = user.content.get('roles', [])
                        if roles is None:
                            roles = []
                        elif isinstance(roles, str):
                            roles = [roles]
                        
                        # Ensure capabilities is a list
                        capabilities = user.content.get('capabilities', [])
                        if capabilities is None:
                            capabilities = []
                        elif isinstance(capabilities, str):
                            capabilities = [capabilities]
                        
                        user_info = {
                            "username": user.name,
                            "real_name": user.content.get('realname', "N/A") or "N/A",
                            "email": user.content.get('email', "N/A") or "N/A",
                            "roles": roles,
                            "capabilities": capabilities,
                            "default_app": user.content.get('defaultApp', "search") or "search",
                            "type": user.content.get('type', "user") or "user"
                        }
                        users.append(user_info)
                        logger.debug(f"✅ Successfully processed user: {user.name}")
                    else:
                        # Handle users without content
                        user_info = {
                            "username": user.name,
                            "real_name": "N/A",
                            "email": "N/A",
                            "roles": [],
                            "capabilities": [],
                            "default_app": "search",
                            "type": "user"
                        }
                        users.append(user_info)
                        logger.warning(f"⚠️ User {user.name} has no content, using default values")
                except Exception as e:
                    logger.warning(f"⚠️ Error processing user {user.name}: {str(e)}")
                    continue
                
            logger.info(f"✅ Found {len(users)} users")
            return users
            
        except Exception as e:
            logger.error(f"❌ Error listing users: {str(e)}")
            raise
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. It discloses the admin privilege requirement, which is useful behavioral context. However, it doesn't mention other traits like pagination, rate limits, or return format, leaving gaps in behavioral understanding.

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 a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and includes essential context (admin privileges) without unnecessary elaboration.

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?

For a tool with 0 parameters and no output schema, the description covers the basic purpose and permission requirement adequately. However, without annotations or output schema, it lacks details on return format (e.g., list structure, fields) and other behavioral aspects, making it minimally complete.

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

Parameters4/5

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

The tool has 0 parameters, and schema description coverage is 100%, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline 4 for this context.

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 verb ('List') and resource ('all Splunk users'), making the purpose unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'current_user' or 'list_indexes', which would require a 5.

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

Usage Guidelines4/5

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

The description provides clear context with 'requires admin privileges', indicating when this tool is appropriate. It doesn't explicitly state when not to use it or name alternatives like 'current_user' for non-admin scenarios, preventing a score of 5.

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/livehybrid/splunk-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server