Public/Get-GraphDetail.ps1

function Get-GraphDetail {
    <#
    .SYNOPSIS
        Returns the full GraphShell catalog detail for one Microsoft Graph PowerShell cmdlet.
    .DESCRIPTION
        Get-GraphDetail loads only the detail shard(s) that contain the requested cmdlet
        (using the detailShard identifier from the compact index) instead of the whole
        ~25 MB detail catalog, and returns the complete official metadata for it: module,
        HTTP method, endpoint, API version, full permission list, aliases, variants, output
        type, official documentation link and, when known, rename history.
 
        When the endpoint has no path placeholders (such as "/me" or "/users"), an
        Invoke-MgGraphRequest equivalent is also included. GraphShell never calls Microsoft
        Graph or your tenant, and never invents required parameters or object IDs.
    .PARAMETER Name
        The Microsoft Graph PowerShell cmdlet name, for example "Get-MgUser". Accepts the
        Cmdlet property from Get-GraphMapping over the pipeline.
    .EXAMPLE
        Get-GraphDetail Get-MgUser
    .EXAMPLE
        Get-GraphMapping -Permission "Application.ReadWrite.All" | Get-GraphDetail
    .OUTPUTS
        GraphShell.Detail
    #>

    [CmdletBinding()]
    [OutputType('GraphShell.Detail')]
    param(
        [Parameter(Mandatory, Position = 0, ValueFromPipeline, ValueFromPipelineByPropertyName)]
        [Alias('Cmdlet')]
        [string]$Name
    )

    process {
        $catalog = Get-GraphCatalogIndex
        $renameIndex = Get-GraphRenameIndex

        $records = $null
        if (-not $catalog.ByCommand.TryGetValue($Name, [ref]$records)) {
            Write-Warning "GraphShell catalog has no cmdlet, alias or variant matching '$Name'."
            return
        }

        foreach ($record in $records) {
            $shard = Get-GraphDetailShard -Shard $record.detailShard
            $detail = $null
            if ($shard) { $shard.ById.TryGetValue($record.id, [ref]$detail) | Out-Null }

            if (-not $detail) {
                Write-Warning "GraphShell could not load detail shard '$($record.detailShard)' for '$Name'."
                continue
            }

            $permissions = $detail.original.Permissions | Select-Object Name, PermissionType, IsAdmin, IsLeastPrivilege, Description

            $renamedFrom = $null
            $renameList = $null
            if ($renameIndex.ByNewCmdlet.TryGetValue($record.command, [ref]$renameList)) {
                $renamedFrom = ($renameList | Select-Object -ExpandProperty oldCmdlet) -join ', '
            }

            $restEquivalent = $null
            $restNote = $null
            if ($record.uri -match '\{[^}]+\}') {
                $restNote = 'Endpoint requires one or more path parameters (id values); GraphShell does not invent them.'
            }
            else {
                $restEquivalent = "Invoke-MgGraphRequest -Method $($record.method) -Uri `"https://graph.microsoft.com/$($record.apiVersion)$($record.uri)`""
            }

            [pscustomobject]@{
                PSTypeName       = 'GraphShell.Detail'
                Cmdlet           = $record.command
                Module           = $record.module
                ModuleName       = $record.moduleName
                Method           = $record.method
                Endpoint         = $record.uri
                ApiVersion       = $record.apiVersion
                Permissions      = $permissions
                CommandAlias     = $detail.original.CommandAlias
                Aliases          = $record.aliases
                Variants         = $record.variants
                OutputType       = $detail.original.OutputType
                ApiReferenceLink = $detail.original.ApiReferenceLink
                RenamedFrom      = $renamedFrom
                RestEquivalent   = $restEquivalent
                RestNote         = $restNote
                Id               = $record.id
                DetailShard      = $record.detailShard
            }
        }
    }
}