Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

repo_get_repo_by_name_or_id

Retrieve specific repositories in Azure DevOps using project name or ID and repository name or ID, facilitating precise repository management with PAT authentication.

Instructions

Get the repository by project and repository name or ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectYesProject name or ID where the repository is located.
repositoryNameOrIdYesRepository name or ID.

Implementation Reference

  • The handler function that retrieves repositories for the given project using the Azure DevOps Git API, finds the matching repository by name or ID, and returns it as JSON.
    async ({ project, repositoryNameOrId }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const repositories = await gitApi.getRepositories(project); const repository = repositories?.find((repo) => repo.name === repositoryNameOrId || repo.id === repositoryNameOrId); if (!repository) { throw new Error(`Repository ${repositoryNameOrId} not found in project ${project}`); } return { content: [{ type: "text", text: JSON.stringify(repository, null, 2) }], }; }
  • Zod schema defining the input parameters: project (name or ID) and repositoryNameOrId.
    { project: z.string().describe("Project name or ID where the repository is located."), repositoryNameOrId: z.string().describe("Repository name or ID."), },
  • Registers the tool on the MCP server using server.tool, referencing the tool name from REPO_TOOLS, with description, input schema, and handler.
    server.tool( REPO_TOOLS.get_repo_by_name_or_id, "Get the repository by project and repository name or ID.", { project: z.string().describe("Project name or ID where the repository is located."), repositoryNameOrId: z.string().describe("Repository name or ID."), }, async ({ project, repositoryNameOrId }) => { const connection = await connectionProvider(); const gitApi = await connection.getGitApi(); const repositories = await gitApi.getRepositories(project); const repository = repositories?.find((repo) => repo.name === repositoryNameOrId || repo.id === repositoryNameOrId); if (!repository) { throw new Error(`Repository ${repositoryNameOrId} not found in project ${project}`); } return { content: [{ type: "text", text: JSON.stringify(repository, null, 2) }], }; } );
  • Part of the REPO_TOOLS constant object that maps the internal identifier to the actual tool name string used in registration.
    get_repo_by_name_or_id: "repo_get_repo_by_name_or_id",

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