get_role
Retrieve comprehensive details of a specific role, including permissions and settings, by providing the role ID. Essential for managing access and security configurations on Panther MCP Server.
Instructions
Get detailed information about a Panther role by ID
Returns complete role information including all permissions and settings.
Permissions:{'all_of': ['Read User Info']}
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role_id | Yes | The ID of the role to fetch |
Implementation Reference
- The main handler function for the 'get_role' tool. It retrieves detailed role information from the Panther API using the provided role_id, handles 404 not found cases, and returns success/error responses.async def get_role( role_id: Annotated[ str, Field( description="The ID of the role to fetch", examples=["Admin"], ), ], ) -> dict[str, Any]: """Get detailed information about a Panther role by ID Returns complete role information including all permissions and settings. """ logger.info(f"Fetching role details for role ID: {role_id}") try: async with get_rest_client() as client: # Allow 404 as a valid response to handle not found case result, status = await client.get( f"/roles/{role_id}", expected_codes=[200, 404] ) if status == 404: logger.warning(f"No role found with ID: {role_id}") return { "success": False, "message": f"No role found with ID: {role_id}", } logger.info(f"Successfully retrieved role details for role ID: {role_id}") return {"success": True, "role": result} except Exception as e: logger.error(f"Failed to get role details: {str(e)}") return { "success": False, "message": f"Failed to get role details: {str(e)}", }
- src/mcp_panther/panther_mcp_core/tools/roles.py:107-112 (registration)The @mcp_tool decorator registers the get_role tool, specifying required permissions (USER_READ) and marking it as read-only.@mcp_tool( annotations={ "permissions": all_perms(Permission.USER_READ), "readOnlyHint": True, } )
- Input schema for the get_role tool parameter 'role_id', defined as a required string with description and example.role_id: Annotated[ str, Field( description="The ID of the role to fetch", examples=["Admin"], ), ],