Skip to main content

Usage

// Check hook event type
if (input.HookEventName == HookEventName.PreToolUse)
{
    // Handle pre-tool-use logic
}

// Make permission decisions
output.HookSpecificOutput = new PreToolUseSpecificOutput<object>
{
    PermissionDecision = PermissionDecision.Allow,
    PermissionDecisionReason = "Auto-approved by policy"
};

// Block operations
output.Decision = HookDecision.Block;
output.Reason = "Operation not permitted";

// Check permission mode
if (input.PermissionMode == PermissionMode.BypassPermissions)
{
    // Skip checks in bypass mode
}

Types

Classes

NameSummary
CompactTriggerRepresents what triggered a compact operation.
HookDecisionRepresents a hook’s decision to block or allow an operation.
HookEventNameRepresents the different types of hook events that can be triggered in Claude Code.
NotificationTypeRepresents the type of notification sent by Claude Code.
PermissionDecisionRepresents the decision for a PreToolUse permission check.
PermissionModeRepresents the permission mode under which Claude Code is operating.
PermissionRequestBehaviorRepresents the behavior decision for a PermissionRequest hook.
SessionEndReasonRepresents the reason why a session ended.
SessionStartSourceRepresents the source that triggered a session start event.

Enums

NameSummary
CompactTriggerRepresents what triggered a compact operation.
HookDecisionRepresents a hook’s decision to block or allow an operation.
HookEventNameRepresents the different types of hook events that can be triggered in Claude Code.
NotificationTypeRepresents the type of notification sent by Claude Code.
PermissionDecisionRepresents the decision for a PreToolUse permission check.
PermissionModeRepresents the permission mode under which Claude Code is operating.
PermissionRequestBehaviorRepresents the behavior decision for a PermissionRequest hook.
SessionEndReasonRepresents the reason why a session ended.
SessionStartSourceRepresents the source that triggered a session start event.