( config: ExecutorMcpServerConfig<E>, fn: (client: Client) => Promise<void>, )
| 115 | }; |
| 116 | |
| 117 | const withClient = async <E extends Cause.YieldableError>( |
| 118 | config: ExecutorMcpServerConfig<E>, |
| 119 | fn: (client: Client) => Promise<void>, |
| 120 | ) => { |
| 121 | const mcpServer = await Effect.runPromise( |
| 122 | createExecutorMcpServer({ |
| 123 | connections: { list: () => Effect.succeed([]) }, |
| 124 | integrations: { list: () => Effect.succeed([]) }, |
| 125 | ...config, |
| 126 | }), |
| 127 | ); |
| 128 | const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair(); |
| 129 | const client = new Client({ name: "test-client", version: "1.0.0" }, { capabilities: {} }); |
| 130 | await mcpServer.connect(serverTransport); |
| 131 | await client.connect(clientTransport); |
| 132 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: test helper must close MCP transports after async client assertions |
| 133 | try { |
| 134 | await fn(client); |
| 135 | } finally { |
| 136 | await clientTransport.close(); |
| 137 | await serverTransport.close(); |
| 138 | } |
| 139 | }; |
| 140 | |
| 141 | const decodeJsonString = Schema.decodeUnknownSync(Schema.fromJsonString(Schema.String)); |
| 142 | const decodeJsonRecord = Schema.decodeUnknownSync( |
no test coverage detected