Skip to content
Source
Sign inSign up
Open History to see the last commit

connectMcpApproval.ts

23 lines940 Bytes

1import {
2 type ConnectMcpApprovalCall,
3 createConnectMcpApprovalCommand,
4} from "@t3tools/client-runtime/state/connectMcpApproval";
5import { squashAtomCommandFailure } from "@t3tools/client-runtime/state/runtime";
6import type { EnvironmentId } from "@t3tools/contracts";
7import * as Result from "effect/Result";
8​
9import { connectionAtomRuntime } from "../connection/runtime";
10import { appAtomRegistry } from "../rpc/atomRegistry";
11​
12const connectMcpApproval = createConnectMcpApprovalCommand(connectionAtomRuntime);
13​
14/** One agent sign-in call to `environmentId`, sent with this account's T3 Connect session. */
15export async function runConnectMcpApproval(
16 environmentId: EnvironmentId,
17 call: ConnectMcpApprovalCall,
18) {
19 const result = await connectMcpApproval.run(appAtomRegistry, { environmentId, call });
20 return result._tag === "Success"
21 ? Result.succeed(result.value)
22 : Result.fail(squashAtomCommandFailure(result));