MCPcopy
hub / github.com/codeaashu/claude-code / executePostToolHooks

Function executePostToolHooks

src/utils/hooks.ts:3450–3477  ·  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

3448 * @returns Async generator that yields progress messages and blocking errors for automated feedback
3449 */
3450export async function* executePostToolHooks<ToolInput, ToolResponse>(
3451 toolName: string,
3452 toolUseID: string,
3453 toolInput: ToolInput,
3454 toolResponse: ToolResponse,
3455 toolUseContext: ToolUseContext,
3456 permissionMode?: string,
3457 signal?: AbortSignal,
3458 timeoutMs: number = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
3459): AsyncGenerator<AggregatedHookResult> {
3460 const hookInput: PostToolUseHookInput = {
3461 ...createBaseHookInput(permissionMode, undefined, toolUseContext),
3462 hook_event_name: 'PostToolUse',
3463 tool_name: toolName,
3464 tool_input: toolInput,
3465 tool_response: toolResponse,
3466 tool_use_id: toolUseID,
3467 }
3468
3469 yield* executeHooks({
3470 hookInput,
3471 toolUseID,
3472 matchQuery: toolName,
3473 signal,
3474 timeoutMs,
3475 toolUseContext,
3476 })
3477}
3478
3479/**
3480 * 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