home / skills / dianel555 / dskills / grok-search

grok-search skill

/skills/grok-search

This skill enhances web search and real time content retrieval using Grok API, enabling up-to-date information, multi-source aggregation, and rapid

npx playbooks add skill dianel555/dskills --skill grok-search

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
3.3 KB
---
name: grok-search
description: |
  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 GrokSearch MCP tools.
---

# Grok Search

Enhanced web search via Grok API. Supports both MCP server and standalone CLI.

## Execution Methods

### Method 1: MCP Tools (if available)
Use `mcp__groksearch__*` tools directly.

### Method 2: CLI Script (no MCP dependency)
Run `scripts/groksearch_cli.py` via Bash:

```bash
# Prerequisites: pip install httpx tenacity
# Environment: GROK_API_URL, GROK_API_KEY

# Web search
python scripts/groksearch_cli.py web_search --query "search terms" [--platform "GitHub"] [--min-results 3] [--max-results 10]

# Fetch webpage
python scripts/groksearch_cli.py web_fetch --url "https://..." [--out file.md]

# Check config
python scripts/groksearch_cli.py get_config_info [--no-test]

# Switch model
python scripts/groksearch_cli.py switch_model --model "grok-2-latest"

# Toggle built-in tools
python scripts/groksearch_cli.py toggle_builtin_tools --action on|off|status [--root /path/to/project]
```

## Tool Routing Policy

### Forced Replacement Rules

| Scenario | Disabled | Force Use |
|----------|----------|-----------|
| Web Search | `WebSearch` | `mcp__groksearch__web_search` or CLI `web_search` |
| Web Fetch | `WebFetch` | `mcp__groksearch__web_fetch` or CLI `web_fetch` |

### Tool Capability Matrix

| Tool | Parameters | Output |
|------|------------|--------|
| `web_search` | `query`(required), `platform`/`min_results`/`max_results`(optional) | `[{title,url,description}]` |
| `web_fetch` | `url`(required), `out`(optional) | Structured Markdown |
| `get_config_info` | `no_test`(optional) | `{api_url,status,connection_test}` |
| `switch_model` | `model`(required) | `{previous_model,current_model}` |
| `toggle_builtin_tools` | `action`(on/off/status), `root`(optional) | `{blocked,deny_list}` |

## Search Workflow

### Phase 1: Query Construction
- **Intent Recognition**: Broad search → `web_search` | Deep retrieval → `web_fetch`
- **Parameter Optimization**: Set `platform` for specific sources, adjust result counts

### Phase 2: Search Execution
1. Start with `web_search` for structured summaries
2. Use `web_fetch` on key URLs if summaries insufficient
3. Retry with adjusted query if first round unsatisfactory

### Phase 3: Result Synthesis
1. Cross-reference multiple sources
2. **Must annotate source and date** for time-sensitive info
3. **Must include source URLs**: `Title [<sup>1</sup>](URL)`

## Error Handling

| Error | Recovery |
|-------|----------|
| Connection Failure | Run `get_config_info`, verify API URL/Key |
| No Results | Broaden search terms |
| Fetch Timeout | Try alternative sources |

## Anti-Patterns

| Prohibited | Correct |
|------------|---------|
| No source citation | Include `Source [<sup>1</sup>](URL)` |
| Give up after one failure | Retry at least once |
| Use built-in WebSearch/WebFetch | Use GrokSearch tools/CLI |

Overview

This skill provides enhanced web search and real-time content retrieval via the Grok API, replacing built-in WebSearch/WebFetch with forced tool routing. It supports both MCP tool invocation and a standalone CLI, enabling up-to-date fact checking, news monitoring, and deep webpage extraction. Use it when you need reliable multi-source aggregation and explicit source citation for time-sensitive information.

How this skill works

The skill routes web queries to GrokSearch tools: web_search returns structured summaries (title, url, description) while web_fetch retrieves full webpage content as Markdown. When MCP tools are available it calls mcp__groksearch__* endpoints; otherwise it falls back to the CLI script. Results are synthesized across sources with required source URLs and date annotations, and the workflow includes automatic retries and parameter tuning.

When to use it

  • Real-time news, breaking events, or anything beyond the model cutoff
  • Fact checking or multi-source verification across websites
  • Extracting full webpage content or parsing a specific URL
  • Aggregating technical docs, changelogs, or developer resources
  • Replacing default WebSearch/WebFetch behavior with Grok tools

Best practices

  • Start with web_search for summaries, then web_fetch key URLs for depth
  • Specify platform (e.g., GitHub) and adjust min/max results to focus sources
  • Always include source title, URL, and retrieval date for time-sensitive claims
  • Retry with broader queries if initial search returns no results
  • Run get_config_info when encountering connection or auth issues

Example use cases

  • Find the latest announcements and link to original press releases
  • Fetch and convert a documentation page to Markdown for analysis
  • Aggregate multiple blog posts to verify a technical claim
  • Monitor a project repo on GitHub for recent commits or releases
  • Switch models or toggle built-in tools during troubleshooting

FAQ

How does this replace built-in WebSearch/WebFetch?

The skill forces routing to GrokSearch tools (mcp__groksearch__web_search / web_fetch) or the CLI equivalents, preventing use of default WebSearch/WebFetch.

What if the Grok API connection fails?

Run get_config_info to check api_url and key, verify network, then retry. The CLI provides diagnostics with --no-test to inspect settings.