Skip to main content
Glama
panther-labs

Panther MCP Server

Official

list_roles

Read-only

Retrieve and display all roles from your Panther security monitoring instance with metadata including permissions and settings for access management.

Instructions

List all roles from your Panther instance.

Returns list of roles with metadata including permissions and settings.

Permissions:{'all_of': ['Read User Info']}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
name_containsNoCase-insensitive substring to search for within the role name
nameNoExact match for a role's name. If provided, other parameters are ignored
role_idsNoList of specific role IDs to return
sort_dirNoSort direction for the resultsasc

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The complete implementation of the 'list_roles' tool, including the @mcp_tool decorator for registration, input schema via Annotated Fields with Pydantic Field descriptions, and the full handler logic that queries the Panther REST API for roles, filters the response, and returns formatted results with pagination info.
    @mcp_tool(
        annotations={
            "permissions": all_perms(Permission.USER_READ),
            "readOnlyHint": True,
        }
    )
    async def list_roles(
        name_contains: Annotated[
            str | None,
            Field(
                description="Case-insensitive substring to search for within the role name",
                examples=["Admin", "Analyst", "Read"],
            ),
        ] = None,
        name: Annotated[
            str | None,
            Field(
                description="Exact match for a role's name. If provided, other parameters are ignored",
                examples=["Admin", "PantherReadOnly", "SecurityAnalyst"],
            ),
        ] = None,
        role_ids: Annotated[
            list[str],
            Field(
                description="List of specific role IDs to return",
                examples=[["Admin", "PantherReadOnly"], ["SecurityAnalyst"]],
            ),
        ] = [],
        sort_dir: Annotated[
            str | None,
            Field(
                description="Sort direction for the results",
                examples=["asc", "desc"],
            ),
        ] = "asc",
    ) -> dict[str, Any]:
        """List all roles from your Panther instance.
    
        Returns list of roles with metadata including permissions and settings.
        """
        logger.info("Fetching roles from Panther")
    
        try:
            # Prepare query parameters based on API spec
            params = {}
            if name_contains:
                params["name-contains"] = name_contains
            if name:
                params["name"] = name
            if role_ids:
                # Convert list to comma-delimited string as per API spec
                params["ids"] = ",".join(role_ids)
            if sort_dir:
                params["sort-dir"] = sort_dir
    
            async with get_rest_client() as client:
                result, _ = await client.get("/roles", params=params)
    
            # Extract roles and pagination info
            roles = result.get("results", [])
            next_cursor = result.get("next")
    
            # Keep only specific fields for each role to limit the amount of data returned
            filtered_roles_metadata = [
                {
                    "id": role["id"],
                    "name": role.get("name"),
                    "permissions": role.get("permissions"),
                    "logTypeAccess": role.get("logTypeAccess"),
                    "logTypeAccessKind": role.get("logTypeAccessKind"),
                    "createdAt": role.get("createdAt"),
                    "updatedAt": role.get("updatedAt"),
                }
                for role in roles
            ]
    
            logger.info(f"Successfully retrieved {len(filtered_roles_metadata)} roles")
    
            return {
                "success": True,
                "roles": filtered_roles_metadata,
                "total_roles": len(filtered_roles_metadata),
                "has_next_page": bool(next_cursor),
                "next_cursor": next_cursor,
            }
        except Exception as e:
            logger.error(f"Failed to list roles: {str(e)}")
            return {"success": False, "message": f"Failed to list roles: {str(e)}"}
Behavior4/5

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

The annotations provide readOnlyHint=true, indicating a safe read operation. The description adds valuable context beyond this: it specifies the return format ('list of roles with metadata including permissions and settings') and includes a permissions requirement ('Read User Info'), which is crucial for the agent to understand access needs. It doesn't mention rate limits or pagination, but with annotations covering safety, this is sufficient.

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

Conciseness4/5

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

The description is appropriately sized with three sentences: purpose statement, return details, and permissions. It's front-loaded with the core functionality. The permissions section is slightly verbose but necessary. No wasted words, though it could be slightly more structured (e.g., bullet points for permissions).

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

Completeness5/5

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

Given the context: annotations cover safety (readOnlyHint), schema coverage is 100% for parameters, and an output schema exists (implied by 'Returns list of roles'), the description is complete. It adds permissions context and clarifies the return format, which complements the structured data well. No significant gaps remain for this list operation.

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

Parameters3/5

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

The input schema has 100% description coverage, with clear documentation for all four parameters (name_contains, name, role_ids, sort_dir). The description doesn't add any parameter-specific information beyond what's in the schema, such as explaining interactions between parameters (e.g., 'name' overriding others). This meets the baseline of 3 since the schema does the heavy lifting.

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: 'List all roles from your Panther instance.' It specifies the verb ('List') and resource ('roles'), and distinguishes it from the sibling tool 'get_role' which likely retrieves a single role. However, it doesn't explicitly differentiate from other list_* tools like 'list_users' or 'list_detections', which follow a similar pattern.

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

Usage Guidelines3/5

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

The description implies usage context through the permissions requirement ('Read User Info') and mentions returning metadata, but it doesn't provide explicit guidance on when to use this tool versus alternatives like 'get_role' (for a single role) or other list_* tools. No when-not-to-use scenarios or prerequisites beyond permissions are stated.

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/panther-labs/mcp-panther'

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