Skip to main content
Glama

list_repositories

Retrieve a list of all Git repositories stored in a specified directory path using the Git MCP server, for easy management and access.

Instructions

List all git repositories in the configured path

Returns:
    List of repository names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'list_repositories' tool. It retrieves the git_repos_path from the context, lists directories containing a .git folder, and returns their names as a list of strings. The @mcp.tool() decorator registers this function as an MCP tool.
    @mcp.tool()
    def list_repositories(ctx: Context) -> List[str]:
        """List all git repositories in the configured path
    
        Returns:
            List of repository names
        """
        git_repos_path = ctx.request_context.lifespan_context.git_repos_path
    
        if not os.path.exists(git_repos_path):
            raise ValueError(f"Git repositories path does not exist: {git_repos_path}")
    
        repos = []
        for item in os.listdir(git_repos_path):
            item_path = os.path.join(git_repos_path, item)
            if os.path.isdir(item_path) and os.path.exists(os.path.join(item_path, ".git")):
                repos.append(item)
    
        return repos

Tool Definition Quality

Score is being calculated. Check back soon.

Install Server

Other Tools

Related Tools

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/kjozsa/git-mcp'

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