Skip to main content
Glama
AstroMined
by AstroMined

get_issue

Retrieve detailed information about a specific GitHub issue by providing the repository owner, repository name, and issue number.

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' decorated with @tool decorator. Validates input using GetIssueParams, calls operations.get_issue, formats response, and handles errors.
    @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 schema GetIssueParams for input parameters (inherits RepositoryRef for owner/repo, adds issue_number). Provides validation for the tool.
    class GetIssueParams(RepositoryRef): """Parameters for getting an issue.""" model_config = ConfigDict(strict=True) issue_number: int = Field(..., description="Issue number to retrieve", strict=True)
  • Registration function for issue tools, including 'get_issue' in the issue_tools list and calling register_tools to register with MCP server.
    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")
  • Core helper function implementing the GitHub API interaction for retrieving an issue using PyGithub's repository.get_issue and converting the result.
    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)

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