Files
simstudioai--sim/apps/sim/tools/google_meet/list_participants.ts
T
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

131 lines
3.9 KiB
TypeScript

import {
type GoogleMeetApiParticipantListResponse,
type GoogleMeetApiParticipantResponse,
type GoogleMeetListParticipantsParams,
type GoogleMeetListParticipantsResponse,
MEET_API_BASE,
} from '@/tools/google_meet/types'
import type { ToolConfig } from '@/tools/types'
export const listParticipantsTool: ToolConfig<
GoogleMeetListParticipantsParams,
GoogleMeetListParticipantsResponse
> = {
id: 'google_meet_list_participants',
name: 'Google Meet List Participants',
description: 'List participants of a conference record',
version: '1.0.0',
oauth: {
required: true,
provider: 'google-meet',
},
params: {
accessToken: {
type: 'string',
required: true,
visibility: 'hidden',
description: 'Access token for Google Meet API',
},
conferenceName: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Conference record resource name (e.g., conferenceRecords/abc123)',
},
filter: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Filter participants (e.g., earliest_start_time > "2024-01-01T00:00:00Z")',
},
pageSize: {
type: 'number',
required: false,
visibility: 'user-or-llm',
description: 'Maximum number of participants to return (default 100, max 250)',
},
pageToken: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Page token from a previous list request',
},
},
request: {
url: (params: GoogleMeetListParticipantsParams) => {
const trimmed = params.conferenceName.trim()
const name = trimmed.startsWith('conferenceRecords/')
? trimmed
: `conferenceRecords/${trimmed}`
const queryParams = new URLSearchParams()
if (params.filter) queryParams.append('filter', params.filter)
if (params.pageSize) queryParams.append('pageSize', params.pageSize.toString())
if (params.pageToken) queryParams.append('pageToken', params.pageToken)
const queryString = queryParams.toString()
return `${MEET_API_BASE}/${name}/participants${queryString ? `?${queryString}` : ''}`
},
method: 'GET',
headers: (params: GoogleMeetListParticipantsParams) => ({
Authorization: `Bearer ${params.accessToken}`,
}),
},
transformResponse: async (response: Response) => {
if (!response.ok) {
const error = await response.text().catch(() => 'Unknown error')
throw new Error(`Google Meet API error (${response.status}): ${error}`)
}
const data: GoogleMeetApiParticipantListResponse = await response.json()
const participants = data.participants ?? []
const getDisplayName = (p: GoogleMeetApiParticipantResponse): string | null => {
return (
p.signedinUser?.displayName ??
p.anonymousUser?.displayName ??
p.phoneUser?.displayName ??
null
)
}
const getUserType = (p: GoogleMeetApiParticipantResponse): string => {
if (p.signedinUser) return 'signed_in'
if (p.anonymousUser) return 'anonymous'
if (p.phoneUser) return 'phone'
return 'unknown'
}
return {
success: true,
output: {
participants: participants.map((p) => ({
name: p.name,
earliestStartTime: p.earliestStartTime,
latestEndTime: p.latestEndTime ?? null,
displayName: getDisplayName(p),
userType: getUserType(p),
})),
nextPageToken: data.nextPageToken ?? null,
totalSize: data.totalSize ?? null,
},
}
},
outputs: {
participants: {
type: 'json',
description: 'List of participants with name, times, display name, and user type',
},
nextPageToken: {
type: 'string',
description: 'Token for next page of results',
optional: true,
},
totalSize: { type: 'number', description: 'Total number of participants', optional: true },
},
}