Skip to main content
Glama
Nikhil-Patil-RI

Github-Oauth MCP Server

get_user_repositories

Fetch repositories for authenticated GitHub users to manage and access their code projects through OAuth-secured connections.

Instructions

Fetch the repositories of the authenticated user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_user_repositories' tool. It is decorated with @mcp.tool() for registration and implements the logic to retrieve and format the user's GitHub repositories using the GitHub API and the stored access token.
    @mcp.tool()
    async def get_user_repositories() -> str:
        """Fetch the repositories of the authenticated user."""
        global access_token
    
        if not access_token:
            return "You are not authorized. Please authorize first."
    
        url = f"{GITHUB_API_BASE}/user/repos"
        headers = {
            "Authorization": f"Bearer {access_token}",
            "User-Agent": USER_AGENT,
            "Accept": "application/vnd.github.v3+json",
        }
        data = await make_request(url, headers)
        if not data:
            return "Unable to fetch repositories."
    
        if isinstance(data, list):
            repos = []
            for repo in data:
                repos.append(f"Name: {repo['name']}, URL: {repo['html_url']}, Language: {repo.get('language', 'Unknown')}")
            return "\n---\n".join(repos)
    
        return "No repositories found."
  • Helper utility function used by get_user_repositories to perform authenticated HTTP requests to the GitHub API.
    async def make_request(url: str, headers: dict[str, str], params: dict[str, str] = None) -> Optional[dict[str, Any]]:
        """Make an HTTP GET request with error handling."""
        async with httpx.AsyncClient() as client:
            try:
                response = await client.get(url, headers=headers, params=params, timeout=30.0)
                response.raise_for_status()
                return response.json()
            except Exception as e:
                print(f"Request failed: {e}")
                return None
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states 'fetch' but doesn't clarify if this is a read-only operation, what data format is returned, or any rate limits or authentication requirements. This leaves significant gaps in understanding the tool's behavior beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that directly states the tool's purpose without any fluff. It's front-loaded and efficiently communicates the essential information, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is incomplete. It doesn't explain what the repositories data includes, how it's formatted, or any error conditions. For a tool that likely returns structured data, this leaves the agent without enough context to use it effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't add unnecessary param details, earning a baseline score of 4 for not overcomplicating a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('fetch') and resource ('repositories of the authenticated user'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_user_profile', which might also retrieve user-related data, leaving room for improvement in sibling distinction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites like authentication, nor does it compare to sibling tools such as 'authorize_github' or 'get_user_profile', leaving the agent to infer usage context without explicit direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Nikhil-Patil-RI/MCP-Github-Oauth'

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