(result: McpCallResult)
| 120 | * rather than silently skipping the browser leg). |
| 121 | */ |
| 122 | export const parseBrowserApproval = (result: McpCallResult): McpBrowserApproval => { |
| 123 | const structured = (result.raw as { structuredContent?: unknown })?.structuredContent; |
| 124 | const record = (structured ?? {}) as { |
| 125 | status?: unknown; |
| 126 | executionId?: unknown; |
| 127 | approvalUrl?: unknown; |
| 128 | }; |
| 129 | if ( |
| 130 | record.status !== "user_approval_required" || |
| 131 | typeof record.executionId !== "string" || |
| 132 | typeof record.approvalUrl !== "string" |
| 133 | ) { |
| 134 | throw new Error( |
| 135 | `expected a browser approval-required result, got: ${JSON.stringify(structured)}`, |
| 136 | ); |
| 137 | } |
| 138 | return { executionId: record.executionId, approvalUrl: record.approvalUrl }; |
| 139 | }; |
| 140 | |
| 141 | export interface McpSession { |
| 142 | readonly listTools: () => Effect.Effect<ReadonlyArray<string>>; |
no outgoing calls
no test coverage detected