({
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
})
| 4468 | } |
| 4469 | |
| 4470 | export async function executeElicitationHooks({ |
| 4471 | serverName, |
| 4472 | message, |
| 4473 | requestedSchema, |
| 4474 | permissionMode, |
| 4475 | signal, |
| 4476 | timeoutMs = TOOL_HOOK_EXECUTION_TIMEOUT_MS, |
| 4477 | mode, |
| 4478 | url, |
| 4479 | elicitationId, |
| 4480 | }: { |
| 4481 | serverName: string |
| 4482 | message: string |
| 4483 | requestedSchema?: Record<string, unknown> |
| 4484 | permissionMode?: string |
| 4485 | signal?: AbortSignal |
| 4486 | timeoutMs?: number |
| 4487 | mode?: 'form' | 'url' |
| 4488 | url?: string |
| 4489 | elicitationId?: string |
| 4490 | }): Promise<ElicitationHookResult> { |
| 4491 | const hookInput: ElicitationHookInput = { |
| 4492 | ...createBaseHookInput(permissionMode), |
| 4493 | hook_event_name: 'Elicitation', |
| 4494 | mcp_server_name: serverName, |
| 4495 | message, |
| 4496 | mode, |
| 4497 | url, |
| 4498 | elicitation_id: elicitationId, |
| 4499 | requested_schema: requestedSchema, |
| 4500 | } |
| 4501 | |
| 4502 | const results = await executeHooksOutsideREPL({ |
| 4503 | hookInput, |
| 4504 | matchQuery: serverName, |
| 4505 | signal, |
| 4506 | timeoutMs, |
| 4507 | }) |
| 4508 | |
| 4509 | let elicitationResponse: ElicitationResponse | undefined |
| 4510 | let blockingError: HookBlockingError | undefined |
| 4511 | |
| 4512 | for (const result of results) { |
| 4513 | const parsed = parseElicitationHookOutput(result, 'Elicitation') |
| 4514 | if (parsed.blockingError) { |
| 4515 | blockingError = parsed.blockingError |
| 4516 | } |
| 4517 | if (parsed.response) { |
| 4518 | elicitationResponse = parsed.response |
| 4519 | } |
| 4520 | } |
| 4521 | |
| 4522 | return { elicitationResponse, blockingError } |
| 4523 | } |
| 4524 | |
| 4525 | export async function executeElicitationResultHooks({ |
| 4526 | serverName, |
no test coverage detected