Skip to main content
Glama

list_channels

Retrieve detailed information about all channels in a Microsoft Team, including names, descriptions, types, and IDs, by specifying the team ID for streamlined management and analysis.

Instructions

List all channels in a specific Microsoft Team. Returns channel names, descriptions, types, and IDs for the specified team.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesTeam ID

Implementation Reference

  • Registration of the 'list_channels' MCP tool, including inline schema definition (teamId parameter) and handler function that retrieves and summarizes channels from a Microsoft Team using the Graph API.
    server.tool( "list_channels", "List all channels in a specific Microsoft Team. Returns channel names, descriptions, types, and IDs for the specified team.", { teamId: z.string().describe("Team ID"), }, async ({ teamId }) => { try { const client = await graphService.getClient(); const response = (await client .api(`/teams/${teamId}/channels`) .get()) as GraphApiResponse<Channel>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No channels found in this team.", }, ], }; } const channelList: ChannelSummary[] = response.value.map((channel: Channel) => ({ id: channel.id, displayName: channel.displayName, description: channel.description, membershipType: channel.membershipType, })); return { content: [ { type: "text", text: JSON.stringify(channelList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } } );
  • Handler function for 'list_channels' tool: fetches channels via Graph API `/teams/{teamId}/channels`, maps to ChannelSummary, returns JSON stringified list or error message.
    async ({ teamId }) => { try { const client = await graphService.getClient(); const response = (await client .api(`/teams/${teamId}/channels`) .get()) as GraphApiResponse<Channel>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No channels found in this team.", }, ], }; } const channelList: ChannelSummary[] = response.value.map((channel: Channel) => ({ id: channel.id, displayName: channel.displayName, description: channel.description, membershipType: channel.membershipType, })); return { content: [ { type: "text", text: JSON.stringify(channelList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } } );
  • Input schema for 'list_channels' tool using Zod: requires 'teamId' string.
    teamId: z.string().describe("Team ID"), },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/floriscornel/teams-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server