Skip to main content
Glama
salwks

mcp-techTrend

github_search

Read-onlyIdempotent

Find GitHub repositories on specific topics by keyword. Filter by language and creation recency, then sort by stars to identify trending projects.

Instructions

Search GitHub repositories by keyword via the official Search API. USE THIS WHEN: user has a specific topic ('medical imaging 리포', 'mammography GitHub'). days filters by repository created_at (treats it as 'repos created in the last N days') — pair with sort=stars for a stable trending-substitute. USE github_trending INSTEAD WHEN: no specific topic, just browsing.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
languageNo
daysNo
sortNostars
max_resultsNo
response_formatNomarkdown

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Pydantic input schema for the github_search tool, defining fields: query, language, days, sort, max_results, response_format.
    class GitHubSearchInput(BaseModel):
        model_config = ConfigDict(str_strip_whitespace=True, extra="forbid")
        query: str = Field(..., min_length=1, max_length=300)
        language: str | None = Field(None, max_length=40)
        days: int | None = Field(None, ge=1, le=3650)
        sort: str = Field("stars", pattern=r"^(stars|forks|updated|best-match)$")
        max_results: int = Field(20, ge=1, le=100)
        response_format: ResponseFormat = ResponseFormat.MARKDOWN
  • trends_mcp.py:897-914 (registration)
    Registration of the github_search tool via the @_maybe_tool decorator which conditionally registers with FastMCP if the 'github' source is enabled.
    @_maybe_tool(
        source="github",
        name="github_search",
        description=(
            "Search GitHub repositories by keyword via the official Search API. "
            "USE THIS WHEN: user has a specific topic ('medical imaging 리포', "
            "'mammography GitHub'). `days` filters by repository `created_at` "
            "(treats it as 'repos created in the last N days') — pair with "
            "`sort=stars` for a stable trending-substitute. "
            "USE github_trending INSTEAD WHEN: no specific topic, just browsing."
        ),
        annotations={
            "readOnlyHint": True,
            "destructiveHint": False,
            "openWorldHint": True,
            "idempotentHint": True,
        },
    )
  • Main handler function for the github_search tool. Calls the GitHub Search API with query, language, date filters, and sort options; returns formatted markdown or JSON results.
    async def github_search(
        query: str,
        language: str | None = None,
        days: int | None = None,
        sort: str = "stars",
        max_results: int = 20,
        response_format: ResponseFormat = ResponseFormat.MARKDOWN,
    ) -> str:
        try:
            args = GitHubSearchInput(
                query=query,
                language=language,
                days=days,
                sort=sort,
                max_results=max_results,
                response_format=response_format,
            )
            q_parts = [args.query]
            if args.language:
                q_parts.append(f"language:{args.language}")
            if args.days:
                since_date = (_utc_now() - timedelta(days=args.days)).strftime("%Y-%m-%d")
                q_parts.append(f"created:>{since_date}")
            params: dict[str, Any] = {
                "q": " ".join(q_parts),
                "per_page": args.max_results,
            }
            if args.sort != "best-match":
                params["sort"] = args.sort
                params["order"] = "desc"
            headers = {
                "Accept": "application/vnd.github+json",
                "X-GitHub-Api-Version": "2022-11-28",
            }
            token = os.environ.get("GITHUB_TOKEN")
            if token:
                headers["Authorization"] = f"Bearer {token}"
            ttl = TTL_TRENDING if args.days else TTL_DEFAULT
            data = await _http_get_json(GITHUB_API, params=params, headers=headers, ttl=ttl)
            items = data.get("items", []) if isinstance(data, dict) else []
            repos = [
                {
                    "full_name": r.get("full_name", ""),
                    "url": r.get("html_url", ""),
                    "description": r.get("description") or "",
                    "language": r.get("language"),
                    "stars": r.get("stargazers_count", 0),
                    "forks": r.get("forks_count", 0),
                    "created_at": r.get("created_at"),
                    "updated_at": r.get("updated_at"),
                }
                for r in items[: args.max_results]
            ]
            header = f"GitHub 검색 `{args.query}` ({len(repos)}건)"
            return _format(repos, args.response_format, render_md=lambda x: _render_github_md(x, header))
        except Exception as e:
            return _handle_error(e, "github_search")
  • Helper function that renders a list of GitHub repo dicts into markdown format, used by both github_search and github_trending.
    def _render_github_md(items: list[dict[str, Any]], header: str) -> str:
        if not items:
            return f"# {header}\n\n_결과 없음_"
        lines = [f"# {header}", f"_총 {len(items)}건_", ""]
        for i, r in enumerate(items, 1):
            bits: list[str] = []
            if r.get("language"):
                bits.append(str(r["language"]))
            bits.append(f"⭐{r.get('stars', 0):,}")
            if "forks" in r and r["forks"] is not None:
                bits.append(f"🍴{r['forks']:,}")
            if r.get("stars_period"):
                bits.append(f"📈+{r['stars_period']:,}")
            meta = " · ".join(bits)
            desc = _trim(r.get("description"), 200)
            lines.append(
                f"## {i}. [{r['full_name']}]({r['url']})\n"
                f"- {meta}\n"
                + (f"- {desc}\n" if desc else "")
            )
        return "\n".join(lines)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly, not destructive, idempotent. Description adds that it uses the official Search API and explains the days parameter behavior (treats as created in last N days). Does not mention rate limits or pagination, but output schema may cover return format.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Three sentences: first states purpose, second provides usage guidelines with examples, third explains parameter nuance and alternative tool. Well structured, front-loaded, no unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that annotations cover safety and idempotency, and output schema exists for return format, the description is mostly complete. It covers key usage distinctions and the days parameter nuance. Lacks a note about the required query field, but schema covers that.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so description should compensate. It explains days and sort behavior, but does not detail language, max_results, or response_format parameters beyond what schema provides. Some guidance given, but not fully comprehensive.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Clearly states it searches GitHub repos by keyword via official API. Explicitly differentiates from sibling github_trending by specifying use case: specific topic vs browsing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides explicit when-to-use criteria: use this when user has specific topic, use github_trending instead for general browsing. Also gives tip on using days with sort=stars as a trending substitute.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/salwks/mcp-techTrend'

If you have feedback or need assistance with the MCP directory API, please join our Discord server