search_github_repos
Find trending AI/ML GitHub repositories by keywords, topics, and activity filters to discover relevant research projects and code implementations.
Instructions
Search for trending AI/ML GitHub repositories
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keywords | No | Keywords to search for | |
| topics | No | GitHub topics to filter by (e.g., ['llm', 'transformer']) | |
| min_stars | No | Minimum number of stars | |
| days | No | Look for repos updated in last N days | |
| max_results | No | Maximum number of results |
Input Schema (JSON Schema)
{
"properties": {
"days": {
"default": 30,
"description": "Look for repos updated in last N days",
"type": "integer"
},
"keywords": {
"description": "Keywords to search for",
"items": {
"type": "string"
},
"type": "array"
},
"max_results": {
"default": 25,
"description": "Maximum number of results",
"type": "integer"
},
"min_stars": {
"default": 50,
"description": "Minimum number of stars",
"type": "integer"
},
"topics": {
"description": "GitHub topics to filter by (e.g., ['llm', 'transformer'])",
"items": {
"type": "string"
},
"type": "array"
}
},
"type": "object"
}
Implementation Reference
- src/ai_research_mcp/server.py:395-419 (handler)The main execution handler for the 'search_github_repos' tool. It handles caching, calls the GithubClient to search repositories based on parameters, and formats the results using _format_repos.async def _search_github_repos( self, keywords: Optional[List[str]] = None, topics: Optional[List[str]] = None, min_stars: int = 50, days: int = 30, max_results: int = 25, ) -> str: """Search GitHub repositories.""" cache_key = f"github_{keywords}_{topics}_{min_stars}_{days}" cached = self.cache.get(cache_key, self.cache_expiry["github"]) if cached: repos = cached else: repos = await asyncio.to_thread( self.github.search_repositories, keywords=keywords, topics=topics, min_stars=min_stars, pushed_since=f"{days}d", max_results=max_results, ) self.cache.set(cache_key, repos) return self._format_repos(repos)
- src/ai_research_mcp/server.py:87-120 (registration)The tool registration in list_tools(), defining the name, description, and input schema for 'search_github_repos'.Tool( name="search_github_repos", description="Search for trending AI/ML GitHub repositories", inputSchema={ "type": "object", "properties": { "keywords": { "type": "array", "items": {"type": "string"}, "description": "Keywords to search for", }, "topics": { "type": "array", "items": {"type": "string"}, "description": "GitHub topics to filter by (e.g., ['llm', 'transformer'])", }, "min_stars": { "type": "integer", "description": "Minimum number of stars", "default": 50, }, "days": { "type": "integer", "description": "Look for repos updated in last N days", "default": 30, }, "max_results": { "type": "integer", "description": "Maximum number of results", "default": 25, }, }, }, ),
- Helper function called by the handler to format the search results into a markdown string.def _format_repos(self, repos: List[Dict]) -> str: """Format repositories as markdown.""" if not repos: return "*No repositories found.*" lines = [] for i, repo in enumerate(repos, 1): name = repo.get("full_name", "Unknown") description = repo.get("description", "No description") url = repo.get("url", "") stars = repo.get("stars", 0) language = repo.get("language", "") topics = repo.get("topics", []) lines.append(f"### {i}. [{name}]({url})") lines.append(f"⭐ {stars:,} • {language}") lines.append(f"\n{description}") if topics: topic_tags = " ".join(f"`{t}`" for t in topics[:5]) lines.append(f"\n{topic_tags}") lines.append("") return "\n".join(lines)