Skip to main content
Glama
AstroMined

PyGithub MCP Server

by AstroMined

get_issue

Retrieve specific issue details from GitHub repositories by providing owner, repository name, and issue number parameters.

Instructions

Get details about a specific issue.

Args:
    params: Parameters for getting an issue including:
        - owner: Repository owner (user or organization)
        - repo: Repository name
        - issue_number: Issue number to retrieve

Returns:
    Issue details from GitHub API

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • MCP tool handler for 'get_issue': validates input params, delegates to operations.issues.get_issue, returns formatted JSON response or error.
    @tool()
    def get_issue(params: GetIssueParams) -> dict:
        """Get details about a specific issue.
        
        Args:
            params: Parameters for getting an issue including:
                - owner: Repository owner (user or organization)
                - repo: Repository name
                - issue_number: Issue number to retrieve
        
        Returns:
            Issue details from GitHub API
        """
        try:
            logger.debug(f"get_issue called with params: {params}")
            # Pass the Pydantic model directly to the operation
            result = issues.get_issue(params)
            logger.debug(f"Got result: {result}")
            return {"content": [{"type": "text", "text": json.dumps(result, indent=2)}]}
        except GitHubError as e:
            logger.error(f"GitHub error: {e}")
            return {
                "content": [{"type": "error", "text": format_github_error(e)}],
                "is_error": True
            }
        except Exception as e:
            logger.error(f"Unexpected error: {e}")
            logger.error(traceback.format_exc())
            error_msg = str(e) if str(e) else "An unexpected error occurred"
            return {
                "content": [{"type": "error", "text": f"Internal server error: {error_msg}"}],
                "is_error": True
            }
  • Pydantic input schema for get_issue tool: inherits RepositoryRef (owner/repo), adds required issue_number.
    class GetIssueParams(RepositoryRef):
        """Parameters for getting an issue."""
    
        model_config = ConfigDict(strict=True)
        
        issue_number: int = Field(..., description="Issue number to retrieve", strict=True)
  • Core operation logic: fetches issue via PyGithub client, converts to dict using convert_issue.
    def get_issue(params: GetIssueParams) -> Dict[str, Any]:
        """Get details about a specific issue.
    
        Args:
            params: Validated parameters for getting an issue
    
        Returns:
            Issue details from GitHub API
    
        Raises:
            GitHubError: If the API request fails
        """
        try:
            client = GitHubClient.get_instance()
            repository = client.get_repo(f"{params.owner}/{params.repo}")
            issue = repository.get_issue(params.issue_number)
            return convert_issue(issue)
        except GithubException as e:
            raise GitHubClient.get_instance()._handle_github_exception(e)
  • Registers the get_issue tool (included in issue_tools list) via register_tools utility with the FastMCP server instance.
    def register(mcp: FastMCP) -> None:
        """Register all issue tools with the MCP server.
        
        Args:
            mcp: The MCP server instance
        """
        from pygithub_mcp_server.tools import register_tools
        
        # List of all issue tools to register
        issue_tools = [
            create_issue,
            list_issues,
            get_issue,
            update_issue,
            add_issue_comment,
            list_issue_comments,
            update_issue_comment,
            delete_issue_comment,
            add_issue_labels,
            remove_issue_label,
        ]
        
        register_tools(mcp, issue_tools)
        logger.debug(f"Registered {len(issue_tools)} issue tools")
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It states this is a read operation ('Get details'), which implies it's non-destructive, but doesn't disclose behavioral traits like authentication requirements, rate limits, error handling, or what 'details' include. For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is well-structured with clear sections (Args, Returns) and front-loaded the core purpose. It's concise with no wasted words, though the 'Returns' section is vague ('Issue details from GitHub API') and could be more informative. Overall, it's efficient but not perfectly optimized.

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 no annotations, no output schema, and low schema coverage (0%), the description is incomplete. It covers the basic purpose and parameters but lacks behavioral context, return value details, and usage guidelines. For a tool interacting with an external API (GitHub), this leaves the agent under-informed about how to invoke it effectively.

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

Parameters3/5

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

The schema description coverage is 0%, so the description must compensate. It lists the three parameters (owner, repo, issue_number) with brief explanations, adding meaning beyond the bare schema. However, it doesn't provide examples, format details (e.g., GitHub username conventions), or constraints, leaving room for ambiguity. With low schema coverage, this is minimally adequate.

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 tool's purpose: 'Get details about a specific issue.' It uses a specific verb ('Get') and resource ('issue'), making it easy to understand. However, it doesn't explicitly differentiate from sibling tools like 'list_issues' or 'update_issue', which would be helpful for agent selection.

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 sibling tools like 'list_issues' (for multiple issues) or 'update_issue' (for modifying issues), nor does it specify prerequisites or exclusions. The agent must infer usage from the name alone.

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/AstroMined/pygithub-mcp-server'

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