Skip to content

Dianel555/DSkills / skills/grok-search

grok-search

Verified

Enhanced web search and real-time content retrieval via Grok API with forced tool routing. Use when: (1) Web search / information retrieval / fact-checking, (2) Webpage content extraction / URL parsing, (3) Breaking knowledge cutoff limits for current information, (4) Real-time news and technical documentation, (5) Multi-source information aggregation. Triggers: "search for", "find information about", "latest news", "current", "fetch webpage", "get content from URL". IMPORTANT: This skill REPLACES built-in WebSearch/WebFetch with Grok Search tools.

scripts/groksearch_cli.py

View on GitHub
#!/usr/bin/env python3
"""GrokSearch CLI - Standalone command-line interface for Grok web search."""

import asyncio

from groksearch.cli import build_parser
from groksearch.commands import (
    cmd_get_config_info as _cmd_get_config_info_impl,
)
from groksearch.commands import (
    cmd_switch_model as _cmd_switch_model_impl,
)
from groksearch.commands import (
    cmd_toggle_builtin_tools as _cmd_toggle_builtin_tools_impl,
)
from groksearch.commands import (
    cmd_web_crawl as _cmd_web_crawl_impl,
)
from groksearch.commands import (
    cmd_web_fetch as _cmd_web_fetch_impl,
)
from groksearch.commands import (
    cmd_web_map as _cmd_web_map_impl,
)
from groksearch.commands import (
    cmd_web_research as _cmd_web_research_impl,
)
from groksearch.commands import (
    cmd_web_search as _cmd_web_search_impl,
)
from groksearch.config import Config, config
from groksearch.env import load_dotenv
from groksearch.formatting import extract_json, merge_search_results
from groksearch.http import (
    RETRYABLE_STATUS_CODES,
    _is_retryable_exception,
    _WaitWithRetryAfter,
    close_http_client,
    get_http_client,
    retry_attempts,
)
from groksearch.prompts import FETCH_PROMPT, SEARCH_PROMPT
from groksearch.provider import GrokSearchProvider
from groksearch.tavily import (
    _call_tavily_crawl as _call_tavily_crawl_impl,
)
from groksearch.tavily import (
    _call_tavily_extract as _call_tavily_extract_impl,
)
from groksearch.tavily import (
    _call_tavily_map as _call_tavily_map_impl,
)
from groksearch.tavily import (
    _call_tavily_research as _call_tavily_research_impl,
)
from groksearch.tavily import (
    _call_tavily_search as _call_tavily_search_impl,
)
from groksearch.tavily import (
    _tavily_unavailable_reason as _tavily_unavailable_reason_impl,
)
from groksearch.tavily import (
    _validate_output_schema as _validate_output_schema_impl,
)

load_dotenv()


def _sync_internal_modules() -> None:
    import groksearch.commands as commands_module
    import groksearch.http as http_module
    import groksearch.provider as provider_module
    import groksearch.tavily as tavily_module

    http_module.get_http_client = get_http_client
    http_module.close_http_client = close_http_client
    http_module.retry_attempts = retry_attempts

    provider_module.config = config
    provider_module.get_http_client = get_http_client
    provider_module.retry_attempts = retry_attempts

    tavily_module.config = config
    tavily_module.get_http_client = get_http_client
    tavily_module.retry_attempts = retry_attempts
    tavily_module._tavily_unavailable_reason = _tavily_unavailable_reason

    commands_module.config = config
    commands_module.GrokSearchProvider = GrokSearchProvider
    commands_module.merge_search_results = merge_search_results
    commands_module._call_tavily_search = _call_tavily_search
    commands_module._call_tavily_extract = _call_tavily_extract
    commands_module._call_tavily_map = _call_tavily_map
    commands_module._call_tavily_crawl = _call_tavily_crawl
    commands_module._call_tavily_research = _call_tavily_research
    commands_module._tavily_unavailable_reason = _tavily_unavailable_reason


async def _call_tavily_search(query: str, max_results: int = 6):
    _sync_internal_modules()
    return await _call_tavily_search_impl(query, max_results)


async def _call_tavily_extract(url: str):
    _sync_internal_modules()
    return await _call_tavily_extract_impl(url)


async def _call_tavily_map(
    url: str, instructions: str = "", max_depth: int = 1, max_breadth: int = 20, limit: int = 50, timeout: int = 150
):
    _sync_internal_modules()
    return await _call_tavily_map_impl(url, instructions, max_depth, max_breadth, limit, timeout)


async def _call_tavily_crawl(
    url: str,
    instructions: str = "",
    max_depth=None,
    max_breadth=None,
    limit=None,
    timeout=None,
    select_paths=None,
    exclude_paths=None,
):
    _sync_internal_modules()
    return await _call_tavily_crawl_impl(
        url, instructions, max_depth, max_breadth, limit, timeout, select_paths, exclude_paths
    )


async def _call_tavily_research(
    input_text: str,
    model=None,
    output_length=None,
    citation_format=None,
    output_schema=None,
    include_domains=None,
    exclude_domains=None,
):
    _sync_internal_modules()
    return await _call_tavily_research_impl(
        input_text, model, output_length, citation_format, output_schema, include_domains, exclude_domains
    )


_tavily_unavailable_reason = _tavily_unavailable_reason_impl

_validate_output_schema = _validate_output_schema_impl


async def cmd_web_search(args):
    _sync_internal_modules()
    return await _cmd_web_search_impl(args)


async def cmd_web_fetch(args):
    _sync_internal_modules()
    return await _cmd_web_fetch_impl(args)


async def cmd_web_map(args):
    _sync_internal_modules()
    return await _cmd_web_map_impl(args)


async def cmd_web_crawl(args):
    _sync_internal_modules()
    return await _cmd_web_crawl_impl(args)


async def cmd_web_research(args):
    _sync_internal_modules()
    return await _cmd_web_research_impl(args)


async def cmd_get_config_info(args):
    _sync_internal_modules()
    return await _cmd_get_config_info_impl(args)


async def cmd_switch_model(args):
    _sync_internal_modules()
    return await _cmd_switch_model_impl(args)


async def cmd_toggle_builtin_tools(args):
    _sync_internal_modules()
    return await _cmd_toggle_builtin_tools_impl(args)


async def _run_command(args):
    commands = {
        "web_search": cmd_web_search,
        "web_fetch": cmd_web_fetch,
        "web_map": cmd_web_map,
        "web_crawl": cmd_web_crawl,
        "web_research": cmd_web_research,
        "get_config_info": cmd_get_config_info,
        "switch_model": cmd_switch_model,
        "toggle_builtin_tools": cmd_toggle_builtin_tools,
    }
    try:
        await commands[args.command](args)
    finally:
        await close_http_client()


def main():
    parser = build_parser()
    args = parser.parse_args()

    if args.api_url or args.api_key:
        config.set_overrides(args.api_url, args.api_key)

    asyncio.run(_run_command(args))


__all__ = [
    "Config",
    "FETCH_PROMPT",
    "GrokSearchProvider",
    "RETRYABLE_STATUS_CODES",
    "SEARCH_PROMPT",
    "_WaitWithRetryAfter",
    "_call_tavily_crawl",
    "_call_tavily_extract",
    "_call_tavily_map",
    "_call_tavily_research",
    "_call_tavily_search",
    "_is_retryable_exception",
    "_tavily_unavailable_reason",
    "build_parser",
    "cmd_get_config_info",
    "cmd_switch_model",
    "cmd_toggle_builtin_tools",
    "cmd_web_crawl",
    "cmd_web_fetch",
    "cmd_web_map",
    "cmd_web_research",
    "cmd_web_search",
    "close_http_client",
    "config",
    "extract_json",
    "get_http_client",
    "load_dotenv",
    "main",
    "merge_search_results",
    "retry_attempts",
]


if __name__ == "__main__":
    main()
rea-changelog-updatemorluto/reaPrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
academy-guideanthropics/skillsStop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials, and use cases from Claude Academy (academy.claude.com), Anthropic's learning hub. Trigger on: "how do I", "how can I", "getting started with", "what can Claude do", "teach me", "learn to use"; questions about artifacts, projects, skills, plugins, connectors, MCP; requests about rolling Claude out to a team, class, or organization; and any ask for training materials, onboarding content, or learning resources. Use it when the user is learning how to use a feature or product — not when they are mid-task and just want the task done. This skill composes with other skills: after consulting product documentation to answer how a Claude feature works, also check here for a matching course or tutorial — a docs-grounded answer and an Academy recommendation belong together. Only recommend on a strong match; never invent Academy content.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
claude-apianthropics/skillsReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing/model choice/limits/caching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent/MCP/tool-definition/multi-agent/RAG/LLM-judge/computer-use; generate/summarize/extract/classify/rewrite/converse over NL; debugging refusals/cutoffs/streaming/tool-calls/tokens). SKIP only when another provider is being worked on (overrides all triggers): OpenAI/GPT/Gemini/Llama/Mistral/Cohere/Ollama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).Stars: 198kUpdated Claude CodeCodexUnverifiedInstall
doc-coauthoringanthropics/skillsGuide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.Stars: 198kUpdated Claude CodeCodexVerifiedInstall