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