MCPcopy
hub / github.com/callstack/agent-device / readRequiredConnectScope

Function readRequiredConnectScope

src/cli/commands/connection.ts:129–155  ·  view source on GitHub ↗
(
  flags: CliFlags,
  connectionMetadata: RemoteConnectionRequestMetadata | undefined,
)

Source from the content-addressed store, hash-verified

127}
128
129function readRequiredConnectScope(
130 flags: CliFlags,
131 connectionMetadata: RemoteConnectionRequestMetadata | undefined,
132): { tenant: string; runId: string } {
133 if (!flags.tenant) {
134 throw new AppError(
135 'INVALID_ARGS',
136 'connect requires tenant in remote config or via --tenant <id>.',
137 );
138 }
139 if (!flags.runId) {
140 throw new AppError(
141 'INVALID_ARGS',
142 'connect requires runId in remote config or via --run-id <id>.',
143 );
144 }
145 if (
146 !flags.daemonBaseUrl &&
147 connectionProviderRequiresRemoteDaemon(connectionMetadata?.leaseProvider)
148 ) {
149 throw new AppError(
150 'INVALID_ARGS',
151 'connect requires daemonBaseUrl in remote config, config, env, or --daemon-base-url.',
152 );
153 }
154 return { tenant: flags.tenant, runId: flags.runId };
155}
156
157type ConnectContext = {
158 session: string;

Callers 1

connectCommandFunction · 0.85

Tested by

no test coverage detected