Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

list_repositories

Retrieve a list of repositories within an Azure DevOps project to manage and access source code collections.

Instructions

List repositories in a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
organizationIdNoThe ID or name of the organization (Default: mycompany)
includeLinksNoWhether to include reference links

Implementation Reference

  • Core handler function that executes the list_repositories tool logic: connects to Azure DevOps Git API and retrieves repositories for the given project.
    export async function listRepositories(
      connection: WebApi,
      options: ListRepositoriesOptions,
    ): Promise<GitRepository[]> {
      try {
        const gitApi = await connection.getGitApi();
        const repositories = await gitApi.getRepositories(
          options.projectId,
          options.includeLinks,
        );
    
        return repositories;
      } catch (error) {
        if (error instanceof AzureDevOpsError) {
          throw error;
        }
        throw new Error(
          `Failed to list repositories: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • Zod schema defining the input parameters for the list_repositories tool: projectId, organizationId, includeLinks.
    export const ListRepositoriesSchema = 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})`),
      includeLinks: z
        .boolean()
        .optional()
        .describe('Whether to include reference links'),
    });
  • Tool registration in the repositoriesTools array, specifying name, description, and input schema.
    {
      name: 'list_repositories',
      description: 'List repositories in a project',
      inputSchema: zodToJsonSchema(ListRepositoriesSchema),
    },
  • Dispatcher/registration in handleRepositoriesRequest switch statement that parses args and invokes the listRepositories handler.
    case 'list_repositories': {
      const args = ListRepositoriesSchema.parse(request.params.arguments);
      const result = await listRepositories(connection, {
        ...args,
        projectId: args.projectId ?? defaultProject,
      });
      return {
        content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
      };
    }

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