Skip to main content
Glama

Git Stuff Server

by skurekjakub
adoPrChanges.ts2.31 kB
// src/tools/adoPrChanges/adoPrChanges.ts import { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { getAdoConfig } from "../../utils/configManager.js"; // Adjusted import paths for schema and service assuming flat structure in build/tools import { adoPrChangesSchema, AdoPrChangesInput } from "./adoPrChangesSchema.js"; import { getAdoConnectionAndApi, getPrDetails, getLatestPrIterationChanges } from "./adoPrChangesService.js"; import { formatPrChangesOutput } from "./adoPrChangesFormatter.js"; // Export schema for registration export { adoPrChangesSchema }; export const adoPrChangesHandler = async (input: AdoPrChangesInput): Promise<CallToolResult> => { try { const config = await getAdoConfig(input.organizationId); if (!config.organization || !config.project) { return { content: [{ type: "text", text: "ERROR: Missing required configuration parameters (organization, project). Please ensure Azure CLI is authenticated and configuration is set." }], isError: true }; } const { gitApi } = await getAdoConnectionAndApi(config.organization); const pullRequestIdNum = parseInt(input.pullRequestId, 10); const pr = await getPrDetails(gitApi, pullRequestIdNum, config.project); if (!pr || !pr.repository?.id || !pr.sourceRefName || !pr.targetRefName) { return { content: [{ type: "text", text: "ERROR: Could not retrieve valid PR details." }], isError: true }; } const repositoryId = pr.repository.id; const sourceBranch = pr.sourceRefName.replace("refs/heads/", ""); const targetBranch = pr.targetRefName.replace("refs/heads/", ""); const { iterationChanges, latestIteration } = await getLatestPrIterationChanges(gitApi, repositoryId, pullRequestIdNum, config.project); // Pass necessary arguments to the formatter const output = await formatPrChangesOutput( gitApi, repositoryId, config.project, input.pullRequestId, sourceBranch, targetBranch, iterationChanges, latestIteration ); return { content: [{ type: "text", text: output }] }; } catch (error: any) { console.error("Error processing ADO PR changes:", error); return { content: [{ type: "text", text: `ERROR: Failed to get PR changes. ${error.message}` }], isError: true }; } };

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/skurekjakub/GitStuffServer'

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