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

Method createHookCallback

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

Source from the content-addressed store, hash-verified

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