Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:CrewAIInc CrewAI GitHub Search Tool

From Leeroopedia
Revision as of 11:07, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/CrewAIInc_CrewAI_GitHub_Search_Tool.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains Tools, RAG, GitHub
Last Updated 2026-02-11 00:00 GMT

Overview

Performs RAG-based semantic search across GitHub repository content including code, issues, pull requests, and repository information.

Description

GithubSearchTool extends RagTool to provide semantic search over GitHub repositories. It requires a gh_token for GitHub API access and supports configurable content_types (options: code, repo, pr, issue). The tool supports two modes: a dynamic mode where the repository and content types are specified at runtime via GithubSearchToolSchema, and a fixed mode where a specific repository is pre-configured at construction using FixedGithubSearchToolSchema. Content is registered via the add() method as DataType.GITHUB with metadata including the GitHub token and content type filters. This is not a GitHub API tool but rather a semantic search tool that indexes GitHub content for intelligent retrieval.

Usage

Use this tool when a CrewAI agent needs to semantically search through GitHub repository contents, such as finding relevant code patterns, understanding issue discussions, or reviewing pull request changes.

Code Reference

Source Location

  • Repository: CrewAI
  • File: lib/crewai-tools/src/crewai_tools/tools/github_search_tool/github_search_tool.py
  • Lines: 1-78

Signature

class GithubSearchTool(RagTool):
    name: str = "Search a github repo's content"
    description: str = "A tool that can be used to semantic search a query from a github repo's content. ..."
    summarize: bool = False
    gh_token: str
    args_schema: type[BaseModel] = GithubSearchToolSchema
    content_types: list[str] = ["code", "repo", "pr", "issue"]

    def __init__(self, github_repo: str | None = None,
                 content_types: list[str] | None = None, **kwargs): ...
    def add(self, repo: str, content_types: list[str] | None = None) -> None: ...
    def _run(self, search_query: str, github_repo: str | None = None,
             content_types: list[str] | None = None,
             similarity_threshold: float | None = None, limit: int | None = None) -> str: ...

Import

from crewai_tools import GithubSearchTool

I/O Contract

Inputs

Name Type Required Description
search_query str Yes The semantic search query
github_repo str Yes (at init or runtime) GitHub repository in owner/repo format
content_types list[str] Yes (at init or runtime) Content types to search: code, repo, pr, issue
gh_token str Yes (constructor) GitHub personal access token
similarity_threshold float No Minimum similarity score for results
limit int No Maximum number of results to return

Outputs

Name Type Description
_run() returns str Semantically relevant content from the GitHub repository matching the query

Usage Examples

Dynamic Repository

from crewai_tools import GithubSearchTool

tool = GithubSearchTool(gh_token="ghp_your_token")
result = tool.run(
    search_query="error handling patterns",
    github_repo="crewAIInc/crewAI",
    content_types=["code", "pr"],
)

Fixed Repository

from crewai_tools import GithubSearchTool

tool = GithubSearchTool(
    gh_token="ghp_your_token",
    github_repo="crewAIInc/crewAI",
    content_types=["code", "issue"],
)
result = tool.run(search_query="memory configuration")

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment