MCPcopy Create free account
hub / github.com/codeaashu/claude-code / createHookCallback

Method createHookCallback

src/cli/structuredIO.ts:661–689  ·  view source on GitHub ↗
(callbackId: string, timeout?: number)

Source from the content-addressed store, hash-verified

659 }
660
661 createHookCallback(callbackId: string, timeout?: number): HookCallback {
662 return {
663 type: 'callback',
664 timeout,
665 callback: async (
666 input: HookInput,
667 toolUseID: string | null,
668 abort: AbortSignal | undefined,
669 ): Promise<HookJSONOutput> => {
670 try {
671 const result = await this.sendRequest<HookJSONOutput>(
672 {
673 subtype: 'hook_callback',
674 callback_id: callbackId,
675 input,
676 tool_use_id: toolUseID || undefined,
677 },
678 hookJSONOutputSchema(),
679 abort,
680 )
681 return result
682 } catch (error) {
683 // biome-ignore lint/suspicious/noConsole:: intentional console output
684 console.error(`Error in hook callback ${callbackId}:`, error)
685 return {}
686 }
687 },
688 }
689 }
690
691 /**
692 * Sends an elicitation request to the SDK consumer and returns the response.

Callers 1

handleInitializeRequestFunction · 0.80

Calls 1

errorMethod · 0.45

Tested by

no test coverage detected