list_teams
Retrieve detailed information, including names, descriptions, and IDs, about all Microsoft Teams the user belongs to, facilitating efficient team management and collaboration.
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:30-72 (handler)The handler function for the 'list_teams' tool. It fetches the user's joined teams from the Microsoft Graph API (/me/joinedTeams), maps the results to TeamSummary format (id, displayName, description, isArchived), and returns a JSON stringified list or error message as text content.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:27-73 (registration)Registers the 'list_teams' tool using server.tool() with name, description, empty input schema ({}), and 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/index.ts:134-134 (registration)Top-level call to registerTeamsTools which includes the registration of the 'list_teams' tool among other teams tools.registerTeamsTools(server, graphService);