core_list_project_teams
Retrieve a list of teams for a specific Azure DevOps project, with options to filter by user membership, paginate results, and limit the number of teams returned.
Instructions
Retrieve a list of teams for the specified Azure DevOps project.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mine | No | If true, only return teams that the authenticated user is a member of. | |
| project | Yes | The name or ID of the Azure DevOps project. | |
| skip | No | The number of teams to skip for pagination. Defaults to 0. | |
| top | No | The maximum number of teams to return. Defaults to 100. |
Implementation Reference
- src/tools/core.ts:34-55 (handler)The handler function that executes the tool logic: connects to Azure DevOps CoreApi, fetches teams for the given project (optionally filtering by membership, paginated), returns JSON string or error.async ({ project, mine, top, skip }) => { try { const connection = await connectionProvider(); const coreApi = await connection.getCoreApi(); const teams = await coreApi.getTeams(project, mine, top, skip, false); if (!teams) { return { content: [{ type: "text", text: "No teams found" }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(teams, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error fetching project teams: ${errorMessage}` }], isError: true, }; } }
- src/tools/core.ts:28-33 (schema)Input schema using Zod for validating tool parameters: project (string, required), mine/top/skip (optional).{ project: z.string().describe("The name or ID of the Azure DevOps project."), mine: z.boolean().optional().describe("If true, only return teams that the authenticated user is a member of."), top: z.number().optional().describe("The maximum number of teams to return. Defaults to 100."), skip: z.number().optional().describe("The number of teams to skip for pagination. Defaults to 0."), },
- src/tools/core.ts:25-56 (registration)Registration of the 'core_list_project_teams' tool on the McpServer, including description, schema, and handler.server.tool( CORE_TOOLS.list_project_teams, "Retrieve a list of teams for the specified Azure DevOps project.", { project: z.string().describe("The name or ID of the Azure DevOps project."), mine: z.boolean().optional().describe("If true, only return teams that the authenticated user is a member of."), top: z.number().optional().describe("The maximum number of teams to return. Defaults to 100."), skip: z.number().optional().describe("The number of teams to skip for pagination. Defaults to 0."), }, async ({ project, mine, top, skip }) => { try { const connection = await connectionProvider(); const coreApi = await connection.getCoreApi(); const teams = await coreApi.getTeams(project, mine, top, skip, false); if (!teams) { return { content: [{ type: "text", text: "No teams found" }], isError: true }; } return { content: [{ type: "text", text: JSON.stringify(teams, null, 2) }], }; } catch (error) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return { content: [{ type: "text", text: `Error fetching project teams: ${errorMessage}` }], isError: true, }; } } );
- src/tools/core.ts:13-17 (helper)Constant object mapping internal names to MCP tool names, used in registration.const CORE_TOOLS = { list_project_teams: "core_list_project_teams", list_projects: "core_list_projects", get_identity_ids: "core_get_identity_ids", };
- src/tools.ts:20-20 (registration)Invocation of configureCoreTools which registers the core tools including core_list_project_teams.configureCoreTools(server, tokenProvider, connectionProvider, userAgentProvider);