get_team_members
Retrieve all users who are members of a specific team to audit membership and understand team-based access permissions.
Instructions
Retrieves a list of all users who are members of a specific team, including their basic information and status. Use this to audit team membership and understand who has team-based access.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| teamId | Yes | ID of the team to retrieve members for |
Implementation Reference
- src/tools/team-tools.ts:444-489 (handler)Full implementation of getTeamMembersTool, which registers the 'get_team_members' MCP tool. Includes schema definition and the core handler logic that queries the Dataverse API for team members via the teammembership_association relationship.export function getTeamMembersTool(server: McpServer, client: DataverseClient) { server.registerTool( "get_team_members", { title: "Get Team Members", description: "Retrieves a list of all users who are members of a specific team, including their basic information and status. Use this to audit team membership and understand who has team-based access.", inputSchema: { teamId: z.string().describe("ID of the team to retrieve members for") } }, async (params) => { try { // Get team members through the many-to-many relationship const response = await client.get(`teams(${params.teamId})/teammembership_association?$select=systemuserid,fullname,domainname,businessunitid,isdisabled&$expand=businessunitid($select=name)`); const members = response.value?.map((member: any) => ({ userId: member.systemuserid, fullName: member.fullname, domainName: member.domainname, businessUnitId: member.businessunitid, businessUnitName: member.businessunitid?.name, isDisabled: member.isdisabled })) || []; return { content: [ { type: "text", text: `Team has ${members.length} member(s):\n\n${JSON.stringify(members, null, 2)}` } ] }; } catch (error) { return { content: [ { type: "text", text: `Error retrieving team members: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } } ); }
- src/tools/team-tools.ts:447-453 (schema)Input schema for the 'get_team_members' tool using Zod validation, requiring a teamId string.{ title: "Get Team Members", description: "Retrieves a list of all users who are members of a specific team, including their basic information and status. Use this to audit team membership and understand who has team-based access.", inputSchema: { teamId: z.string().describe("ID of the team to retrieve members for") } },
- src/index.ts:208-208 (registration)Invocation of getTeamMembersTool in the main server setup, which triggers the registration of the 'get_team_members' tool with the MCP server.getTeamMembersTool(server, dataverseClient);