Skip to main content
Glama

list_team_members

Retrieve all members of a Microsoft Team with their names, email addresses, roles, and IDs for team management and collaboration oversight.

Instructions

List all members of a specific Microsoft Team. Returns member names, email addresses, roles, and IDs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
teamIdYesTeam ID

Implementation Reference

  • The main handler function that fetches and returns the list of team members using the Microsoft Graph API for the specified teamId. Maps the response to MemberSummary format and handles errors.
    async ({ teamId }) => { try { const client = await graphService.getClient(); const response = (await client .api(`/teams/${teamId}/members`) .get()) as GraphApiResponse<ConversationMember>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No members found in this team.", }, ], }; } const memberList: MemberSummary[] = response.value.map((member: ConversationMember) => ({ id: member.id, displayName: member.displayName, roles: member.roles, })); return { content: [ { type: "text", text: JSON.stringify(memberList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } }
  • Zod schema defining the input parameter 'teamId' for the list_team_members tool.
    teamId: z.string().describe("Team ID"), },
  • The MCP server.tool registration call that registers the 'list_team_members' tool, including its description, input schema, and handler function.
    "list_team_members", "List all members of a specific Microsoft Team. Returns member names, email addresses, roles, and IDs.", { teamId: z.string().describe("Team ID"), }, async ({ teamId }) => { try { const client = await graphService.getClient(); const response = (await client .api(`/teams/${teamId}/members`) .get()) as GraphApiResponse<ConversationMember>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No members found in this team.", }, ], }; } const memberList: MemberSummary[] = response.value.map((member: ConversationMember) => ({ id: member.id, displayName: member.displayName, roles: member.roles, })); return { content: [ { type: "text", text: JSON.stringify(memberList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } } );

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