INNER CODE UNIT · Python
handle_search_code
nolabs-ai/deepfabric · tools-sdk/components/github/app.py:208
def handle_search_code(args: dict) -> dict:
"""Search for code across GitHub repositories."""
query = args.get("query")
if not query:
return {"success": False, "result": "Missing required: query", "error_type": "InvalidArguments"}
per_page = min(args.get("perPage", 10), 100)
page = args.get("page", 1)
# Note: Code search doesn't have repo restriction in the same way
# Results will come from any public repos matching the query
try:
endpoint = f"/search/code?q={quote(query)}&per_page={per_page}&page={page}"
data = github_api_request(endpoint)
result = {
"total_count": data.get("total_count", 0),