MCPcopy Create free account
hub / github.com/WJX20/claude-code / executePostToolHooks

Function executePostToolHooks

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

Source from the content-addressed store, hash-verified

3534 * @returns Async generator that yields progress messages and blocking errors for automated feedback
3535 */
3536export async function* executePostToolHooks<ToolInput, ToolResponse>(
3537 toolName: string,
3538 toolUseID: string,
3539 toolInput: ToolInput,
3540 toolResponse: ToolResponse,
3541 toolUseContext: ToolUseContext,
3542 permissionMode?: string,
3543 signal?: AbortSignal,
3544 timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
3545): AsyncGenerator<AggregatedHookResult> {
3546 const hookInput: PostToolUseHookInput = {
3547 ...createBaseHookInput(permissionMode, undefined, toolUseContext),
3548 hook_event_name: 'PostToolUse',
3549 tool_name: toolName,
3550 tool_input: toolInput,
3551 tool_response: toolResponse,
3552 tool_use_id: toolUseID,
3553 }
3554
3555 yield* executeHooks({
3556 hookInput,
3557 toolUseID,
3558 matchQuery: toolName,
3559 signal,
3560 timeoutMs,
3561 toolUseContext,
3562 })
3563}
3564
3565/**
3566 * Execute post-tool-use-failure hooks if configured

Callers 1

runPostToolUseHooksFunction · 0.85

Calls 2

createBaseHookInputFunction · 0.85
executeHooksFunction · 0.85

Tested by

no test coverage detected