Skip to main content
Glama
ZeroPathAI

ZeroPath MCP Server

Official
by ZeroPathAI

list_repositories

Lists all repositories in the organization, with optional search filtering to find specific ones.

Instructions

List all repositories in the organization.

Args:
    search_query: Optional search term to filter repositories

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
search_queryNo

Implementation Reference

  • The main handler function for the 'list_repositories' MCP tool. It makes an API request to ZeroPath's repositories/list endpoint, handles the response, and formats it using a helper function.
    @mcp.tool()
    def list_repositories(search_query: str = None) -> str:
        """
        List all repositories in the organization.
    
        Args:
            search_query: Optional search term to filter repositories
        """
        payload = {}
        if search_query:
            payload["searchQuery"] = search_query
    
        response, error = make_api_request("repositories/list", payload)
    
        if error:
            return error
    
        if response.status_code == 200:
            return process_repositories_response(response.json())
        elif response.status_code == 401:
            return "Error: Unauthorized - check API credentials"
        elif response.status_code == 400:
            return f"Error: Bad request - {response.text}"
        else:
            return f"Error: API returned status {response.status_code}: {response.text}"
  • Helper function that processes the raw API response from repositories/list into a human-readable formatted string listing repository details.
    def process_repositories_response(raw_response):
        """Process repositories list response into readable format."""
        # Handle list response directly
        if isinstance(raw_response, list):
            repos = raw_response
        else:
            if "error" in raw_response:
                return f"Error: {raw_response['error']}"
            repos = raw_response.get("repositories", raw_response.get("items", []))
    
        if not repos:
            return "No repositories found."
    
        total_count = len(repos)
        result = f"Found {total_count} repository(ies).\n\n"
    
        for i, repo in enumerate(repos, 1):
            result += f"Repository {i}:\n"
            result += f"  ID: {repo.get('id', 'N/A')}\n"
            result += f"  Name: {repo.get('name', 'N/A')}\n"
            result += f"  Full Name: {repo.get('fullName', repo.get('full_name', 'N/A'))}\n"
            result += f"  Provider: {repo.get('provider', 'N/A')}\n"
            result += f"  Default Branch: {repo.get('defaultBranch', repo.get('scanBranch', 'N/A'))}\n"
            result += f"  PR Scanning: {repo.get('prScanningEnabled', 'N/A')}\n"
            result += f"  Last Scanned: {repo.get('lastScannedAt', 'N/A')}\n"
            result += "\n"
    
        return result
  • The @mcp.tool() decorator registers the list_repositories function as an MCP tool.
    @mcp.tool()

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/ZeroPathAI/zeropath-mcp-server'

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