Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_list_repos_by_project

Retrieve a list of repositories for a specific Azure DevOps project, with optional filters for repository names, maximum results, and skip count, using PAT authentication.

Instructions

Retrieve a list of repositories for a given project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesThe name or ID of the Azure DevOps project.
repoNameFilterNoOptional filter to search for repositories by name. If provided, only repositories with names containing this string will be returned.
skipNoThe number of repositories to skip. Defaults to 0.
topNoThe maximum number of repositories to return.

Implementation Reference

  • The core handler function that implements the logic for listing repositories in a given Azure DevOps project. It fetches repositories using the Git API, applies optional filtering by name, pagination (top/skip), sorts by name, trims to essential properties, and returns as JSON text content.
    async ({ project, top, skip, repoNameFilter }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const repositories = await gitApi.getRepositories(project, false, false, false); const filteredRepositories = repoNameFilter ? filterReposByName(repositories, repoNameFilter) : repositories; const paginatedRepositories = filteredRepositories?.sort((a, b) => a.name?.localeCompare(b.name ?? "") ?? 0).slice(skip, skip + top); // Filter out the irrelevant properties const trimmedRepositories = paginatedRepositories?.map((repo) => ({ id: repo.id, name: repo.name, isDisabled: repo.isDisabled, isFork: repo.isFork, isInMaintenance: repo.isInMaintenance, webUrl: repo.webUrl, size: repo.size, })); return { content: [{ type: "text", text: JSON.stringify(trimmedRepositories, null, 2) }], }; }
  • Zod schema defining the input parameters for the tool: project (required), top (default 100), skip (default 0), repoNameFilter (optional).
    project: z.string().describe("The name or ID of the Azure DevOps project."), top: z.number().default(100).describe("The maximum number of repositories to return."), skip: z.number().default(0).describe("The number of repositories to skip. Defaults to 0."), repoNameFilter: z.string().optional().describe("Optional filter to search for repositories by name. If provided, only repositories with names containing this string will be returned."), },
  • Tool registration call to McpServer.tool() using the mapped tool name REPO_TOOLS.list_repos_by_project which resolves to "repo_list_repos_by_project", along with the tool description.
    REPO_TOOLS.list_repos_by_project, "Retrieve a list of repositories for a given project",
  • Helper utility function used by the handler to filter the list of repositories by a substring match on the repository name (case-insensitive).
    function filterReposByName(repositories: GitRepository[], repoNameFilter: string): GitRepository[] { const lowerCaseFilter = repoNameFilter.toLowerCase(); const filteredByName = repositories?.filter((repo) => repo.name?.toLowerCase().includes(lowerCaseFilter)); return filteredByName; }
  • Mapping in REPO_TOOLS constant from internal key 'list_repos_by_project' to the actual MCP tool name 'repo_list_repos_by_project' used in server.tool registration.
    list_repos_by_project: "repo_list_repos_by_project",

Other Tools

Related Tools

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/ennuiii/DevOpsMcpPAT'

If you have feedback or need assistance with the MCP directory API, please join our Discord server