mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(microsoft-teams): align tools with live Graph API docs, add missing endpoints (#5477)
* fix(microsoft-teams): align tools with live Graph API docs, add missing endpoints - fix list_channel_members/list_team_members falling back to userId when email is missing - add $top=50 pagination to read_channel for parity with read_chat - add list_teams, list_chats, list_channels, list_chat_members tools so agents can discover ids without the UI selectors - all new tools use only existing granted scopes (Team.ReadBasic.All, Chat.ReadBasic, Channel.ReadBasic.All) — no new OAuth scopes requested * fix(microsoft-teams): surface pagination truncation via hasMore flag - add hasMore output (derived from @odata.nextLink presence) to list_teams, list_chats, list_channels, list_chat_members so agents can detect truncated results instead of trusting the count field as a total - do NOT add $top to list_teams' joinedTeams request — Graph docs explicitly state this endpoint does not support OData query parameters, so it would silently no-op
This commit is contained in:
@@ -12,7 +12,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
description: 'Manage messages, reactions, and members in Teams',
|
||||
authMode: AuthMode.OAuth,
|
||||
longDescription:
|
||||
'Integrate Microsoft Teams into the workflow. Read, write, update, and delete chat and channel messages. Reply to messages, add reactions, and list team/channel members. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel. To mention users in messages, wrap their name in `<at>` tags: `<at>userName</at>`',
|
||||
'Integrate Microsoft Teams into the workflow. Read, write, update, and delete chat and channel messages. Reply to messages, add reactions, and list teams, chats, channels, and their members. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel. To mention users in messages, wrap their name in `<at>` tags: `<at>userName</at>`',
|
||||
docsLink: 'https://docs.sim.ai/integrations/microsoft_teams',
|
||||
category: 'tools',
|
||||
integrationType: IntegrationType.Communication,
|
||||
@@ -39,6 +39,10 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
{ label: 'Remove Reaction', id: 'unset_reaction' },
|
||||
{ label: 'List Team Members', id: 'list_team_members' },
|
||||
{ label: 'List Channel Members', id: 'list_channel_members' },
|
||||
{ label: 'List Chat Members', id: 'list_chat_members' },
|
||||
{ label: 'List Teams', id: 'list_teams' },
|
||||
{ label: 'List Chats', id: 'list_chats' },
|
||||
{ label: 'List Channels', id: 'list_channels' },
|
||||
],
|
||||
value: () => 'read_chat',
|
||||
},
|
||||
@@ -83,6 +87,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
'reply_to_message',
|
||||
'list_team_members',
|
||||
'list_channel_members',
|
||||
'list_channels',
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
@@ -105,6 +110,7 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
'reply_to_message',
|
||||
'list_team_members',
|
||||
'list_channel_members',
|
||||
'list_channels',
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
@@ -122,7 +128,13 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
mode: 'basic',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['read_chat', 'write_chat', 'update_chat_message', 'delete_chat_message'],
|
||||
value: [
|
||||
'read_chat',
|
||||
'write_chat',
|
||||
'update_chat_message',
|
||||
'delete_chat_message',
|
||||
'list_chat_members',
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
@@ -136,7 +148,13 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
mode: 'advanced',
|
||||
condition: {
|
||||
field: 'operation',
|
||||
value: ['read_chat', 'write_chat', 'update_chat_message', 'delete_chat_message'],
|
||||
value: [
|
||||
'read_chat',
|
||||
'write_chat',
|
||||
'update_chat_message',
|
||||
'delete_chat_message',
|
||||
'list_chat_members',
|
||||
],
|
||||
},
|
||||
required: true,
|
||||
},
|
||||
@@ -281,6 +299,10 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
'microsoft_teams_unset_reaction',
|
||||
'microsoft_teams_list_team_members',
|
||||
'microsoft_teams_list_channel_members',
|
||||
'microsoft_teams_list_chat_members',
|
||||
'microsoft_teams_list_teams',
|
||||
'microsoft_teams_list_chats',
|
||||
'microsoft_teams_list_channels',
|
||||
],
|
||||
config: {
|
||||
tool: (params) => {
|
||||
@@ -313,6 +335,14 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
return 'microsoft_teams_list_team_members'
|
||||
case 'list_channel_members':
|
||||
return 'microsoft_teams_list_channel_members'
|
||||
case 'list_chat_members':
|
||||
return 'microsoft_teams_list_chat_members'
|
||||
case 'list_teams':
|
||||
return 'microsoft_teams_list_teams'
|
||||
case 'list_chats':
|
||||
return 'microsoft_teams_list_chats'
|
||||
case 'list_channels':
|
||||
return 'microsoft_teams_list_channels'
|
||||
default:
|
||||
return 'microsoft_teams_read_chat'
|
||||
}
|
||||
@@ -393,6 +423,21 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
return { ...baseParams, teamId: effectiveTeamId, channelId: effectiveChannelId }
|
||||
}
|
||||
|
||||
// Chat member operations
|
||||
if (operation === 'list_chat_members') {
|
||||
return { ...baseParams, chatId: effectiveChatId }
|
||||
}
|
||||
|
||||
// List channels in a team
|
||||
if (operation === 'list_channels') {
|
||||
return { ...baseParams, teamId: effectiveTeamId }
|
||||
}
|
||||
|
||||
// List the user's teams / chats — no additional identifiers required
|
||||
if (operation === 'list_teams' || operation === 'list_chats') {
|
||||
return baseParams
|
||||
}
|
||||
|
||||
// Operations that work with either chat or channel (get_message, reactions)
|
||||
// These tools handle the routing internally based on what IDs are provided
|
||||
if (
|
||||
@@ -462,8 +507,18 @@ export const MicrosoftTeamsBlock: BlockConfig<MicrosoftTeamsResponse> = {
|
||||
},
|
||||
reactionType: { type: 'string', description: 'Emoji reaction that was added/removed' },
|
||||
success: { type: 'boolean', description: 'Whether the operation was successful' },
|
||||
members: { type: 'json', description: 'Array of team/channel member objects' },
|
||||
members: { type: 'json', description: 'Array of team/channel/chat member objects' },
|
||||
memberCount: { type: 'number', description: 'Total number of members' },
|
||||
teams: { type: 'json', description: 'Array of teams the user is a member of' },
|
||||
teamCount: { type: 'number', description: 'Total number of teams' },
|
||||
chats: { type: 'json', description: 'Array of chats the user is part of' },
|
||||
chatCount: { type: 'number', description: 'Total number of chats' },
|
||||
channels: { type: 'json', 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',
|
||||
},
|
||||
type: { type: 'string', description: 'Type of Teams message' },
|
||||
id: { type: 'string', description: 'Unique message identifier' },
|
||||
timestamp: { type: 'string', description: 'Message timestamp' },
|
||||
@@ -580,5 +635,12 @@ export const MicrosoftTeamsBlockMeta = {
|
||||
content:
|
||||
'# List Team Members\n\nRetrieve who belongs to a Microsoft Teams team or channel.\n\n## Steps\n1. Decide whether you need team-wide membership or a single channel and pick List Team Members or List Channel Members.\n2. Run the operation with the team id (and channel id when needed).\n3. Normalize the result into a clean roster of names and roles.\n\n## Output\nA roster list with display name and role. Note the total count at the top.',
|
||||
},
|
||||
{
|
||||
name: 'discover-teams-chats-channels',
|
||||
description:
|
||||
'Enumerate the teams, chats, and channels available to the connected Microsoft account before acting on them.',
|
||||
content:
|
||||
'# Discover Teams, Chats, and Channels\n\nResolve human-friendly names to the ids other Microsoft Teams operations need.\n\n## Steps\n1. Run List Teams to see every team the connected account belongs to, or List Chats to see active chats.\n2. If the target is a channel, run List Channels with the resolved team id to find the channel id.\n3. If the target is a chat, run List Chat Members to confirm the right people are present before writing to it.\n4. Feed the resolved team id, channel id, or chat id into the read/write/reply/reaction operations.\n\n## Output\nReturn the matched team, chat, or channel name alongside its id so subsequent steps can reference it.',
|
||||
},
|
||||
],
|
||||
} as const satisfies BlockMeta
|
||||
|
||||
@@ -2,7 +2,11 @@ import { deleteChannelMessageTool } from '@/tools/microsoft_teams/delete_channel
|
||||
import { deleteChatMessageTool } from '@/tools/microsoft_teams/delete_chat_message'
|
||||
import { getMessageTool } from '@/tools/microsoft_teams/get_message'
|
||||
import { listChannelMembersTool } from '@/tools/microsoft_teams/list_channel_members'
|
||||
import { listChannelsTool } from '@/tools/microsoft_teams/list_channels'
|
||||
import { listChatMembersTool } from '@/tools/microsoft_teams/list_chat_members'
|
||||
import { listChatsTool } from '@/tools/microsoft_teams/list_chats'
|
||||
import { listTeamMembersTool } from '@/tools/microsoft_teams/list_team_members'
|
||||
import { listTeamsTool } from '@/tools/microsoft_teams/list_teams'
|
||||
import { readChannelTool } from '@/tools/microsoft_teams/read_channel'
|
||||
import { readChatTool } from '@/tools/microsoft_teams/read_chat'
|
||||
import { replyToMessageTool } from '@/tools/microsoft_teams/reply_to_message'
|
||||
@@ -27,3 +31,7 @@ export const microsoftTeamsSetReactionTool = setReactionTool
|
||||
export const microsoftTeamsUnsetReactionTool = unsetReactionTool
|
||||
export const microsoftTeamsListTeamMembersTool = listTeamMembersTool
|
||||
export const microsoftTeamsListChannelMembersTool = listChannelMembersTool
|
||||
export const microsoftTeamsListChatMembersTool = listChatMembersTool
|
||||
export const microsoftTeamsListTeamsTool = listTeamsTool
|
||||
export const microsoftTeamsListChatsTool = listChatsTool
|
||||
export const microsoftTeamsListChannelsTool = listChannelsTool
|
||||
|
||||
@@ -72,7 +72,7 @@ export const listChannelMembersTool: ToolConfig<
|
||||
const members = (data.value || []).map((member: any) => ({
|
||||
id: member.id || '',
|
||||
displayName: member.displayName || '',
|
||||
email: member.email || member.userId || '',
|
||||
email: member.email || '',
|
||||
userId: member.userId || '',
|
||||
roles: member.roles || [],
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
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 || '',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import type {
|
||||
MicrosoftTeamsListMembersResponse,
|
||||
MicrosoftTeamsToolParams,
|
||||
} from '@/tools/microsoft_teams/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listChatMembersTool: ToolConfig<
|
||||
MicrosoftTeamsToolParams,
|
||||
MicrosoftTeamsListMembersResponse
|
||||
> = {
|
||||
id: 'microsoft_teams_list_chat_members',
|
||||
name: 'List Microsoft Teams Chat Members',
|
||||
description: 'List all members of a Microsoft Teams chat',
|
||||
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',
|
||||
},
|
||||
chatId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
visibility: 'user-or-llm',
|
||||
description: 'The ID of the chat (e.g., "19:abc123def456@thread.v2" - from chat listings)',
|
||||
},
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: { type: 'boolean', description: 'Whether the listing was successful' },
|
||||
members: { type: 'array', description: 'Array of chat members' },
|
||||
memberCount: { type: 'number', description: 'Total number of members' },
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether Graph indicated additional pages beyond this response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params) => {
|
||||
const chatId = params.chatId?.trim()
|
||||
if (!chatId) {
|
||||
throw new Error('Chat ID is required')
|
||||
}
|
||||
return `https://graph.microsoft.com/v1.0/chats/${encodeURIComponent(chatId)}/members`
|
||||
},
|
||||
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 members = (data.value || []).map((member: any) => ({
|
||||
id: member.id || '',
|
||||
displayName: member.displayName || '',
|
||||
email: member.email || '',
|
||||
userId: member.userId || '',
|
||||
roles: member.roles || [],
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
members,
|
||||
memberCount: members.length,
|
||||
hasMore: Boolean(data['@odata.nextLink']),
|
||||
metadata: {
|
||||
chatId: params?.chatId || '',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
import type {
|
||||
MicrosoftTeamsListChatsResponse,
|
||||
MicrosoftTeamsToolParams,
|
||||
} from '@/tools/microsoft_teams/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listChatsTool: ToolConfig<MicrosoftTeamsToolParams, MicrosoftTeamsListChatsResponse> =
|
||||
{
|
||||
id: 'microsoft_teams_list_chats',
|
||||
name: 'List Microsoft Teams Chats',
|
||||
description: 'List the Microsoft Teams chats the current user is part of',
|
||||
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',
|
||||
},
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: { type: 'boolean', description: 'Whether the listing was successful' },
|
||||
chats: { type: 'array', description: 'Array of chats the user is part of' },
|
||||
chatCount: { type: 'number', description: 'Total number of chats' },
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether Graph indicated additional pages beyond this response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
// $top=50 is the maximum page size Graph allows for this endpoint.
|
||||
url: () => 'https://graph.microsoft.com/v1.0/me/chats?$top=50',
|
||||
method: 'GET',
|
||||
headers: (params) => {
|
||||
if (!params.accessToken) {
|
||||
throw new Error('Access token is required')
|
||||
}
|
||||
return {
|
||||
Authorization: `Bearer ${params.accessToken}`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
const chats = (data.value || []).map((chat: any) => ({
|
||||
id: chat.id || '',
|
||||
topic: chat.topic ?? null,
|
||||
chatType: chat.chatType || '',
|
||||
webUrl: chat.webUrl || '',
|
||||
createdDateTime: chat.createdDateTime || '',
|
||||
lastUpdatedDateTime: chat.lastUpdatedDateTime || '',
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
chats,
|
||||
chatCount: chats.length,
|
||||
hasMore: Boolean(data['@odata.nextLink']),
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export const listTeamMembersTool: ToolConfig<
|
||||
const members = (data.value || []).map((member: any) => ({
|
||||
id: member.id || '',
|
||||
displayName: member.displayName || '',
|
||||
email: member.email || member.userId || '',
|
||||
email: member.email || '',
|
||||
userId: member.userId || '',
|
||||
roles: member.roles || [],
|
||||
}))
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import type {
|
||||
MicrosoftTeamsListTeamsResponse,
|
||||
MicrosoftTeamsToolParams,
|
||||
} from '@/tools/microsoft_teams/types'
|
||||
import type { ToolConfig } from '@/tools/types'
|
||||
|
||||
export const listTeamsTool: ToolConfig<MicrosoftTeamsToolParams, MicrosoftTeamsListTeamsResponse> =
|
||||
{
|
||||
id: 'microsoft_teams_list_teams',
|
||||
name: 'List Microsoft Teams',
|
||||
description: 'List the Microsoft Teams the current user is a direct member of',
|
||||
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',
|
||||
},
|
||||
},
|
||||
|
||||
outputs: {
|
||||
success: { type: 'boolean', description: 'Whether the listing was successful' },
|
||||
teams: { type: 'array', description: 'Array of teams the user is a member of' },
|
||||
teamCount: { type: 'number', description: 'Total number of teams' },
|
||||
hasMore: {
|
||||
type: 'boolean',
|
||||
description: 'Whether Graph indicated additional pages beyond this response',
|
||||
},
|
||||
},
|
||||
|
||||
request: {
|
||||
// Note: GET /me/joinedTeams does not support OData query parameters ($top, etc.) per Graph docs:
|
||||
// https://learn.microsoft.com/en-us/graph/api/user-list-joinedteams
|
||||
url: () => 'https://graph.microsoft.com/v1.0/me/joinedTeams',
|
||||
method: 'GET',
|
||||
headers: (params) => {
|
||||
if (!params.accessToken) {
|
||||
throw new Error('Access token is required')
|
||||
}
|
||||
return {
|
||||
Authorization: `Bearer ${params.accessToken}`,
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
|
||||
const teams = (data.value || []).map((team: any) => ({
|
||||
id: team.id || '',
|
||||
displayName: team.displayName || '',
|
||||
description: team.description || '',
|
||||
isArchived: Boolean(team.isArchived),
|
||||
}))
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
teams,
|
||||
teamCount: teams.length,
|
||||
hasMore: Boolean(data['@odata.nextLink']),
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
@@ -68,7 +68,9 @@ export const readChannelTool: ToolConfig<MicrosoftTeamsToolParams, MicrosoftTeam
|
||||
const encodedTeamId = encodeURIComponent(teamId)
|
||||
const encodedChannelId = encodeURIComponent(channelId)
|
||||
|
||||
const url = `https://graph.microsoft.com/v1.0/teams/${encodedTeamId}/channels/${encodedChannelId}/messages`
|
||||
// Graph API's default page size for channel messages is 20; request the max of 50
|
||||
// so a single call surfaces more history without requiring pagination.
|
||||
const url = `https://graph.microsoft.com/v1.0/teams/${encodedTeamId}/channels/${encodedChannelId}/messages?$top=50`
|
||||
|
||||
return url
|
||||
},
|
||||
|
||||
@@ -142,9 +142,65 @@ export interface MicrosoftTeamsListMembersResponse extends ToolResponse {
|
||||
output: {
|
||||
members: MicrosoftTeamsMember[]
|
||||
memberCount: number
|
||||
hasMore?: boolean
|
||||
metadata: {
|
||||
teamId?: string
|
||||
channelId?: string
|
||||
chatId?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Joined team summary (from GET /me/joinedTeams)
|
||||
interface MicrosoftTeamsTeamSummary {
|
||||
id: string
|
||||
displayName: string
|
||||
description?: string
|
||||
isArchived?: boolean
|
||||
}
|
||||
|
||||
export interface MicrosoftTeamsListTeamsResponse extends ToolResponse {
|
||||
output: {
|
||||
teams: MicrosoftTeamsTeamSummary[]
|
||||
teamCount: number
|
||||
hasMore: boolean
|
||||
}
|
||||
}
|
||||
|
||||
// Chat summary (from GET /me/chats)
|
||||
interface MicrosoftTeamsChatSummary {
|
||||
id: string
|
||||
topic: string | null
|
||||
chatType: string
|
||||
webUrl?: string
|
||||
createdDateTime?: string
|
||||
lastUpdatedDateTime?: string
|
||||
}
|
||||
|
||||
export interface MicrosoftTeamsListChatsResponse extends ToolResponse {
|
||||
output: {
|
||||
chats: MicrosoftTeamsChatSummary[]
|
||||
chatCount: number
|
||||
hasMore: boolean
|
||||
}
|
||||
}
|
||||
|
||||
// Channel summary (from GET /teams/{team-id}/channels)
|
||||
interface MicrosoftTeamsChannelSummary {
|
||||
id: string
|
||||
displayName: string
|
||||
description?: string | null
|
||||
membershipType?: string
|
||||
webUrl?: string
|
||||
}
|
||||
|
||||
export interface MicrosoftTeamsListChannelsResponse extends ToolResponse {
|
||||
output: {
|
||||
channels: MicrosoftTeamsChannelSummary[]
|
||||
channelCount: number
|
||||
hasMore: boolean
|
||||
metadata: {
|
||||
teamId: string
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,3 +230,6 @@ export type MicrosoftTeamsResponse =
|
||||
| MicrosoftTeamsDeleteResponse
|
||||
| MicrosoftTeamsListMembersResponse
|
||||
| MicrosoftTeamsReactionResponse
|
||||
| MicrosoftTeamsListTeamsResponse
|
||||
| MicrosoftTeamsListChatsResponse
|
||||
| MicrosoftTeamsListChannelsResponse
|
||||
|
||||
@@ -2339,7 +2339,11 @@ import {
|
||||
microsoftTeamsDeleteChatMessageTool,
|
||||
microsoftTeamsGetMessageTool,
|
||||
microsoftTeamsListChannelMembersTool,
|
||||
microsoftTeamsListChannelsTool,
|
||||
microsoftTeamsListChatMembersTool,
|
||||
microsoftTeamsListChatsTool,
|
||||
microsoftTeamsListTeamMembersTool,
|
||||
microsoftTeamsListTeamsTool,
|
||||
microsoftTeamsReadChannelTool,
|
||||
microsoftTeamsReadChatTool,
|
||||
microsoftTeamsReplyToMessageTool,
|
||||
@@ -7397,6 +7401,10 @@ export const tools: Record<string, ToolConfig> = {
|
||||
microsoft_teams_get_message: microsoftTeamsGetMessageTool,
|
||||
microsoft_teams_list_team_members: microsoftTeamsListTeamMembersTool,
|
||||
microsoft_teams_list_channel_members: microsoftTeamsListChannelMembersTool,
|
||||
microsoft_teams_list_chat_members: microsoftTeamsListChatMembersTool,
|
||||
microsoft_teams_list_teams: microsoftTeamsListTeamsTool,
|
||||
microsoft_teams_list_chats: microsoftTeamsListChatsTool,
|
||||
microsoft_teams_list_channels: microsoftTeamsListChannelsTool,
|
||||
outlook_read: outlookReadTool,
|
||||
outlook_send: outlookSendTool,
|
||||
outlook_draft: outlookDraftTool,
|
||||
|
||||
Reference in New Issue
Block a user