UNPKG

@mcp-apps/azure-devops-mcp-server

Version:

A Model Context Protocol (MCP) server for Azure DevOps integration

47 lines (45 loc) 2.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.listRepositoriesTool = void 0; const zod_1 = require("zod"); const azure_devops_client_1 = require("../utils/azure-devops-client"); // Tool to list repositories exports.listRepositoriesTool = { name: "git-list-repositories", description: ` Lists all Git repositories available in an Azure DevOps project. This tool retrieves information about all repositories within the specified project, including their names, IDs, URLs, and other metadata. Parameters: - organizationUrl: The Azure DevOps organization URL in the format https://dev.azure.com/{organization} Example: https://dev.azure.com/fabrikam - project: The exact name of the Azure DevOps project to list repositories from Example: "FabrikamFiber" `, parameters: { organizationUrl: zod_1.z.string().describe("Azure DevOps organization URL (e.g., https://dev.azure.com/organization)"), project: zod_1.z.string().describe("Project name"), }, handler: async ({ organizationUrl, project }) => { try { const gitApi = await (0, azure_devops_client_1.getGitApi)(organizationUrl); const repositories = await gitApi.getRepositories(project); if (!repositories || repositories.length === 0) { return { content: [{ type: "text", text: `No repositories found in project ${project}.` }], }; } return { content: [{ type: "text", text: JSON.stringify(repositories, null, 2) }], }; } catch (error) { console.error("Error listing repositories:", error); const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: "text", text: `Error listing repositories: ${errorMessage}` }], }; } } }; //# sourceMappingURL=git-list-repositories.js.map