MCPcopy Create free account
hub / github.com/apache/maka / testConnection

Function testConnection

packages/runtime/src/test-connection.ts:68–87  ·  view source on GitHub ↗
(
  connection: LlmConnection,
  apiKey: string,
  model?: string,
  options: ConnectionTestOptions = {},
)

Source from the content-addressed store, hash-verified

66}
67
68export async function testConnection(
69 connection: LlmConnection,
70 apiKey: string,
71 model?: string,
72 options: ConnectionTestOptions = {},
73): Promise<ConnectionTestResult> {
74 const t0 = Date.now();
75 const configuredTimeoutMs = options.timeoutMs;
76 const timeoutMs =
77 typeof configuredTimeoutMs === 'number' &&
78 Number.isFinite(configuredTimeoutMs) &&
79 configuredTimeoutMs > 0
80 ? Math.floor(configuredTimeoutMs)
81 : CONNECTION_TEST_TIMEOUT_MS;
82 try {
83 return await testConnectionStrict(connection, apiKey, model, options.fetch, t0, timeoutMs);
84 } catch (error) {
85 return connectionTestFailure(error, t0, true);
86 }
87}
88
89export async function runConnectionTestEffect(
90 connection: ConnectionEffectConnection,

Callers 1

Calls 3

testConnectionStrictFunction · 0.85
connectionTestFailureFunction · 0.85
nowMethod · 0.65

Tested by

no test coverage detected