Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

get_repository

Retrieve detailed information about a specific Azure DevOps repository by providing its ID or name, including project and organization details.

Instructions

Get details of a specific repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
organizationIdNoThe ID or name of the organization (Default: mycompany)
repositoryIdYesThe ID or name of the repository

Implementation Reference

  • MCP tool handler implementation for 'get_repository': parses arguments with schema, calls core getRepository function using connection and defaults, returns JSON-formatted repository details.
    case 'get_repository': {
      const args = GetRepositorySchema.parse(request.params.arguments);
      const result = await getRepository(
        connection,
        args.projectId ?? defaultProject,
        args.repositoryId,
      );
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }
  • Core helper function that executes the Azure DevOps API call to fetch repository details by ID or name within a project, with error handling.
    export async function getRepository(
      connection: WebApi,
      projectId: string,
      repositoryId: string,
    ): Promise<GitRepository> {
      try {
        const gitApi = await connection.getGitApi();
        const repository = await gitApi.getRepository(repositoryId, projectId);
    
        if (!repository) {
          throw new AzureDevOpsResourceNotFoundError(
            `Repository '${repositoryId}' not found in project '${projectId}'`,
          );
        }
    
        return repository;
      } catch (error) {
        if (error instanceof AzureDevOpsError) {
          throw error;
        }
        throw new Error(
          `Failed to get repository: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • Zod schema defining input validation for get_repository tool: projectId (optional), organizationId (optional), repositoryId (required).
    export const GetRepositorySchema = z.object({
      projectId: z
        .string()
        .optional()
        .describe(`The ID or name of the project (Default: ${defaultProject})`),
      organizationId: z
        .string()
        .optional()
        .describe(`The ID or name of the organization (Default: ${defaultOrg})`),
      repositoryId: z.string().describe('The ID or name of the repository'),
    });
  • Tool definition registration including name, description, and input schema for the 'get_repository' tool.
    {
      name: 'get_repository',
      description: 'Get details of a specific repository',
      inputSchema: zodToJsonSchema(GetRepositorySchema),
    },

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/Tiberriver256/mcp-server-azure-devops'

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