list_teams
Retrieve all Microsoft Teams you belong to, including team names, descriptions, and IDs, for managing your team memberships and accessing team information.
Instructions
List all Microsoft Teams that the current user is a member of. Returns team names, descriptions, and IDs.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/teams.ts:31-72 (handler)The handler function for the 'list_teams' tool. It fetches the current user's joined Microsoft Teams using the Microsoft Graph API endpoint '/me/joinedTeams', maps the response to TeamSummary objects, and returns the list as JSON-formatted text content. Handles empty results and errors gracefully.try { const client = await graphService.getClient(); const response = (await client.api("/me/joinedTeams").get()) as GraphApiResponse<Team>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No teams found.", }, ], }; } const teamList: TeamSummary[] = response.value.map((team: Team) => ({ id: team.id, displayName: team.displayName, description: team.description, isArchived: team.isArchived, })); return { content: [ { type: "text", text: JSON.stringify(teamList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } }
- src/tools/teams.ts:27-73 (registration)Registration of the 'list_teams' tool using server.tool(). It has an empty input schema ({}), a descriptive name and description, and references the inline handler function."list_teams", "List all Microsoft Teams that the current user is a member of. Returns team names, descriptions, and IDs.", {}, async () => { try { const client = await graphService.getClient(); const response = (await client.api("/me/joinedTeams").get()) as GraphApiResponse<Team>; if (!response?.value?.length) { return { content: [ { type: "text", text: "No teams found.", }, ], }; } const teamList: TeamSummary[] = response.value.map((team: Team) => ({ id: team.id, displayName: team.displayName, description: team.description, isArchived: team.isArchived, })); return { content: [ { type: "text", text: JSON.stringify(teamList, null, 2), }, ], }; } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [ { type: "text", text: `❌ Error: ${errorMessage}`, }, ], }; } } );
- src/tools/teams.ts:30-30 (schema)Input schema for 'list_teams' tool, which is empty indicating no parameters are required.async () => {