@mcp-apps/azure-devops-mcp-server
Version:
A Model Context Protocol (MCP) server for Azure DevOps integration
48 lines (45 loc) • 2.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.listProjectsTool = void 0;
const zod_1 = require("zod");
const azure_devops_client_1 = require("../utils/azure-devops-client");
// Tool to list projects
exports.listProjectsTool = {
name: "list-projects",
description: `
Lists all projects available in an Azure DevOps organization.
This tool retrieves a comprehensive list of all projects within the specified Azure DevOps
organization, including their names, IDs, descriptions, and other metadata.
The organization URL must be in the format: https://dev.azure.com/{organization}
Example: https://dev.azure.com/fabrikam
Use this tool to:
- Get an overview of all projects in your organization
- Find specific project details like IDs needed for other operations
- Check project visibility, state, and last update time
`,
parameters: {
organizationUrl: zod_1.z.string().describe("Azure DevOps organization URL (e.g., https://dev.azure.com/organization)"),
},
handler: async ({ organizationUrl }) => {
try {
const coreApi = await (0, azure_devops_client_1.getCoreApi)(organizationUrl);
const projects = await coreApi.getProjects();
if (!projects || projects.length === 0) {
return {
content: [{ type: "text", text: "No projects found in the organization." }],
};
}
return {
content: [{ type: "text", text: JSON.stringify(projects, null, 2) }],
};
}
catch (error) {
console.error("Error listing projects:", error);
const errorMessage = error instanceof Error ? error.message : String(error);
return {
content: [{ type: "text", text: `Error listing projects: ${errorMessage}` }],
};
}
}
};
//# sourceMappingURL=projects.js.map