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
89 lines
2.4 KiB
TypeScript
89 lines
2.4 KiB
TypeScript
import type {
|
|
MicrosoftTeamsListChannelsResponse,
|
|
MicrosoftTeamsToolParams,
|
|
} from '@/tools/microsoft_teams/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const listChannelsTool: ToolConfig<
|
|
MicrosoftTeamsToolParams,
|
|
MicrosoftTeamsListChannelsResponse
|
|
> = {
|
|
id: 'microsoft_teams_list_channels',
|
|
name: 'List Microsoft Teams Channels',
|
|
description: 'List all channels in a Microsoft Teams team',
|
|
version: '1.0',
|
|
errorExtractor: 'nested-error-object',
|
|
oauth: {
|
|
required: true,
|
|
provider: 'microsoft-teams',
|
|
},
|
|
params: {
|
|
accessToken: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'hidden',
|
|
description: 'The access token for the Microsoft Teams API',
|
|
},
|
|
teamId: {
|
|
type: 'string',
|
|
required: true,
|
|
visibility: 'user-or-llm',
|
|
description:
|
|
'The ID of the team (e.g., "12345678-abcd-1234-efgh-123456789012" - a GUID from team listings)',
|
|
},
|
|
},
|
|
|
|
outputs: {
|
|
success: { type: 'boolean', description: 'Whether the listing was successful' },
|
|
channels: { type: 'array', description: 'Array of channels in the team' },
|
|
channelCount: { type: 'number', description: 'Total number of channels' },
|
|
hasMore: {
|
|
type: 'boolean',
|
|
description: 'Whether Graph indicated additional pages beyond this response',
|
|
},
|
|
},
|
|
|
|
request: {
|
|
url: (params) => {
|
|
const teamId = params.teamId?.trim()
|
|
if (!teamId) {
|
|
throw new Error('Team ID is required')
|
|
}
|
|
return `https://graph.microsoft.com/v1.0/teams/${encodeURIComponent(teamId)}/channels`
|
|
},
|
|
method: 'GET',
|
|
headers: (params) => {
|
|
if (!params.accessToken) {
|
|
throw new Error('Access token is required')
|
|
}
|
|
return {
|
|
Authorization: `Bearer ${params.accessToken}`,
|
|
}
|
|
},
|
|
},
|
|
|
|
transformResponse: async (response: Response, params?: MicrosoftTeamsToolParams) => {
|
|
const data = await response.json()
|
|
|
|
const channels = (data.value || []).map((channel: any) => ({
|
|
id: channel.id || '',
|
|
displayName: channel.displayName || '',
|
|
description: channel.description ?? '',
|
|
membershipType: channel.membershipType || 'standard',
|
|
webUrl: channel.webUrl || '',
|
|
}))
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
channels,
|
|
channelCount: channels.length,
|
|
hasMore: Boolean(data['@odata.nextLink']),
|
|
metadata: {
|
|
teamId: params?.teamId || '',
|
|
},
|
|
},
|
|
}
|
|
},
|
|
}
|