MCPcopy Index your code
hub / github.com/codeaashu/claude-code / executePermissionDeniedHooks

Function executePermissionDeniedHooks

src/utils/hooks.ts:3529–3562  ·  view source on GitHub ↗
(
  toolName: string,
  toolUseID: string,
  toolInput: ToolInput,
  reason: string,
  toolUseContext: ToolUseContext,
  permissionMode?: string,
  signal?: AbortSignal,
  timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
)

Source from the content-addressed store, hash-verified

3527}
3528
3529export async function* executePermissionDeniedHooks<ToolInput>(
3530 toolName: string,
3531 toolUseID: string,
3532 toolInput: ToolInput,
3533 reason: string,
3534 toolUseContext: ToolUseContext,
3535 permissionMode?: string,
3536 signal?: AbortSignal,
3537 timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
3538): AsyncGenerator<AggregatedHookResult> {
3539 const appState = toolUseContext.getAppState()
3540 const sessionId = toolUseContext.agentId ?? getSessionId()
3541 if (!hasHookForEvent('PermissionDenied', appState, sessionId)) {
3542 return
3543 }
3544
3545 const hookInput: PermissionDeniedHookInput = {
3546 ...createBaseHookInput(permissionMode, undefined, toolUseContext),
3547 hook_event_name: 'PermissionDenied',
3548 tool_name: toolName,
3549 tool_input: toolInput,
3550 tool_use_id: toolUseID,
3551 reason,
3552 }
3553
3554 yield* executeHooks({
3555 hookInput,
3556 toolUseID,
3557 matchQuery: toolName,
3558 signal,
3559 timeoutMs,
3560 toolUseContext,
3561 })
3562}
3563
3564/**
3565 * Execute notification hooks if configured

Callers 1

Calls 4

getSessionIdFunction · 0.85
hasHookForEventFunction · 0.85
createBaseHookInputFunction · 0.85
executeHooksFunction · 0.85

Tested by

no test coverage detected