({
serverName,
message,
requestedSchema,
permissionMode,
signal,
timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS,
mode,
url,
elicitationId,
}: {
serverName: string
message: string
requestedSchema?: Record<string, unknown>
permissionMode?: string
signal?: AbortSignal
timeoutMs?: number
mode?: 'form' | 'url'
url?: string
elicitationId?: string
})
| 4636 | } |
| 4637 | |
| 4638 | export async function executeElicitationHooks({ |
| 4639 | serverName, |
| 4640 | message, |
| 4641 | requestedSchema, |
| 4642 | permissionMode, |
| 4643 | signal, |
| 4644 | timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, |
| 4645 | mode, |
| 4646 | url, |
| 4647 | elicitationId, |
| 4648 | }: { |
| 4649 | serverName: string |
| 4650 | message: string |
| 4651 | requestedSchema?: Record<string, unknown> |
| 4652 | permissionMode?: string |
| 4653 | signal?: AbortSignal |
| 4654 | timeoutMs?: number |
| 4655 | mode?: 'form' | 'url' |
| 4656 | url?: string |
| 4657 | elicitationId?: string |
| 4658 | }): Promise<ElicitationHookResult> { |
| 4659 | const hookInput: ElicitationHookInput = { |
| 4660 | ...createBaseHookInput(permissionMode), |
| 4661 | hook_event_name: 'Elicitation', |
| 4662 | mcp_server_name: serverName, |
| 4663 | message, |
| 4664 | mode, |
| 4665 | url, |
| 4666 | elicitation_id: elicitationId, |
| 4667 | requested_schema: requestedSchema, |
| 4668 | } |
| 4669 | |
| 4670 | const results = await executeHooksOutsideREPL({ |
| 4671 | hookInput, |
| 4672 | matchQuery: serverName, |
| 4673 | signal, |
| 4674 | timeoutMs, |
| 4675 | }) |
| 4676 | |
| 4677 | let elicitationResponse: ElicitationResponse | undefined |
| 4678 | let blockingError: HookBlockingError | undefined |
| 4679 | |
| 4680 | for (const result of results) { |
| 4681 | const parsed = parseElicitationHookOutput(result, 'Elicitation') |
| 4682 | if (parsed.blockingError) { |
| 4683 | blockingError = parsed.blockingError |
| 4684 | } |
| 4685 | if (parsed.response) { |
| 4686 | elicitationResponse = parsed.response |
| 4687 | } |
| 4688 | } |
| 4689 | |
| 4690 | return { elicitationResponse, blockingError } |
| 4691 | } |
| 4692 | |
| 4693 | export async function executeElicitationResultHooks({ |
| 4694 | serverName, |
no test coverage detected