MCPcopy Create free account
hub / github.com/Noumena-Network/code / executePostToolHooks

Function executePostToolHooks

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

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