MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / connectionToListItem

Function connectionToListItem

packages/core/sdk/src/core-tools.ts:394–419  ·  view source on GitHub ↗
(connection: Connection, verbose: boolean)

Source from the content-addressed store, hash-verified

392/** Lean projection for `connections.list`. Summarizes `oauthScope` and health
393 * diagnostics unless `verbose`, where the full grant string is included too. */
394const connectionToListItem = (connection: Connection, verbose: boolean) => ({
395 owner: connection.owner,
396 name: String(connection.name),
397 integration: String(connection.integration),
398 template: String(connection.template),
399 provider: String(connection.provider),
400 address: String(connection.address),
401 identityLabel: connection.identityLabel ?? null,
402 description: connection.description ?? null,
403 expiresAt: connection.expiresAt ?? null,
404 oauthClient: connection.oauthClient == null ? null : String(connection.oauthClient),
405 oauthClientOwner: connection.oauthClientOwner ?? null,
406 oauthScopeCount: oauthScopeCount(connection.oauthScope),
407 // Keep full probe diagnostics behind the explicit verbose opt-in.
408 lastHealth:
409 connection.lastHealth == null || verbose
410 ? (connection.lastHealth ?? null)
411 : {
412 status: connection.lastHealth.status,
413 ...(connection.lastHealth.identity !== undefined
414 ? { identity: connection.lastHealth.identity }
415 : {}),
416 checkedAt: connection.lastHealth.checkedAt,
417 },
418 ...(verbose ? { oauthScope: connection.oauthScope ?? null } : {}),
419});
420
421const toolToOutput = (toolRow: Tool) => ({
422 address: String(toolRow.address),

Callers 1

core-tools.tsFile · 0.85

Calls 1

oauthScopeCountFunction · 0.85

Tested by

no test coverage detected