|
21 | 21 | import logging |
22 | 22 | import traceback |
23 | 23 | from os import getenv |
24 | | -from typing import Any, Dict, List |
| 24 | +from typing import Any, Dict, List, Literal |
25 | 25 | from mcp.server.fastmcp import FastMCP |
26 | 26 | from .github_integration import GitHubIntegration as GI |
27 | 27 | from .ip_integration import IPIntegration as IP |
@@ -210,21 +210,22 @@ async def add_github_pr_comment(repo_owner: str, repo_name: str, pr_number: int, |
210 | 210 | return {"status": "error", "message": error_msg} |
211 | 211 |
|
212 | 212 | @self.mcp.tool() |
213 | | - async def list_github_issues_prs(repo_owner: str, issue: str) -> dict[str, Any]: |
| 213 | + async def list_github_issues_prs(repo_owner: str, issue: Literal['pr', 'issue'] = 'pr', filtering: Literal['user', 'owner', 'involves'] = 'involves') -> dict[str, Any]: |
214 | 214 | """ |
215 | 215 | Lists open issues or pull requests for a specified GitHub repository. |
216 | 216 | - Present the issues or pull requests in a markdown table format. |
217 | 217 | - Add index column to the table, and make the title link to the issue or pull request. |
218 | 218 | Args: |
219 | 219 | repo_owner (str): The owner of the GitHub repository. |
220 | | - issue (str): The type of items to list, either 'pr' for pull requests or 'issue' for issues. Defaults to 'pr'. |
| 220 | + issue (Literal['pr', 'issue']): The type of item to list, either 'pr' for pull requests or 'issue' for issues. Defaults to 'pr'. |
| 221 | + filtering (Literal['user', 'owner', 'involves']): The filtering criteria for the search. Defaults to 'involves'. |
221 | 222 | Returns: |
222 | 223 | dict[str, Any]: A dictionary containing the list of open issues or pull requests. |
223 | 224 | Returns an error message if an exception occurs during the listing process. |
224 | 225 | """ |
225 | 226 | logging.info({"status": "info", "message": f"Listing open {issue} for {repo_owner}"}) |
226 | 227 | try: |
227 | | - open_issues_prs = self.gi.list_open_issues_prs(repo_owner, issue) |
| 228 | + open_issues_prs = self.gi.list_open_issues_prs(repo_owner, issue, filtering) |
228 | 229 | return open_issues_prs |
229 | 230 | except Exception as e: |
230 | 231 | error_msg = f"Error listing {issue} for {repo_owner}: {str(e)}" |
|
0 commit comments