Skip to main content
Glama

list_channels

Retrieve all channels in a Microsoft Team to view names, descriptions, types, and IDs for team management and organization.

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

  • The handler function for the 'list_channels' tool. It retrieves channels for a given teamId using Microsoft Graph API, maps them to ChannelSummary, and returns JSON or error.
    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}`,
            },
          ],
        };
      }
    }
  • Zod schema for 'list_channels' tool input: requires 'teamId' string.
    {
      teamId: z.string().describe("Team ID"),
    },
  • Registration of the 'list_channels' tool using server.tool(), including name, description, schema, and handler.
    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}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool lists channels and returns specific data, but doesn't disclose behavioral traits such as whether it's read-only, pagination handling, rate limits, authentication needs, or error conditions. The description is minimal and lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose and key details without unnecessary words. It directly communicates what the tool does, the required input, and the output structure, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's low complexity (1 parameter, no output schema, no annotations), the description is adequate for basic understanding but incomplete. It covers the purpose and return data, but lacks details on behavioral aspects like safety, performance, or error handling, which are important for a tool with no annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with the single parameter 'teamId' documented as 'Team ID'. The description adds value by contextualizing this as 'a specific Microsoft Team', but doesn't provide additional semantics like format examples or validation rules beyond what the schema already covers.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List all channels') and resource ('in a specific Microsoft Team'), and specifies the return data ('channel names, descriptions, types, and IDs'). It distinguishes from siblings like 'list_teams' by focusing on channels within a team, but doesn't explicitly differentiate from other channel-related tools like 'get_channel_messages'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying 'in a specific Microsoft Team' and the required 'teamId' parameter, suggesting it's for retrieving channel information within a team context. However, it lacks explicit guidance on when to use this tool versus alternatives like 'list_teams' or 'get_channel_messages', and doesn't mention prerequisites or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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