Gemini CLI Fetch
Fetches content from websites that Claude cannot directly access using Gemini CLI as a fallback.
Prerequisites
- Gemini CLI must be installed:
npm install -g @google/gemini-clior equivalent - Gemini must be authenticated (run
gemini authfirst)
Usage
Invoke with a URL:
/mp-gemini-fetch https://reddit.com/r/programming/top
Workflow
Step 1: Validate URL
Check if the URL is provided and valid.
Step 2: Execute Gemini CLI
IMPORTANT: Use -p flag for non-interactive mode. Without it, Gemini expects stdin and fails.
gemini -p "Fetch and summarize the main content from this URL: [URL]. Include key points, any code snippets, and relevant discussion highlights."
Use longer timeout for complex pages:
gemini -p "..." --timeout 120000
Step 3: Capture Output
Parse the Gemini response and format it for use.
Step 4: Return Results
Present the fetched content to the user:
"Fetched from: [URL]
Content: [Gemini's summary/content]
Note: This content was fetched via Gemini CLI as a fallback."
Common Use Cases
- Reddit threads (blocked by default)
- Sites with aggressive bot detection
- Content behind soft paywalls
- Forums and discussion boards
Error Handling
If Gemini CLI fails:
- "No input provided via stdin" → You forgot the
-pflag. Usegemini -p "prompt" - Check if Gemini is installed:
gemini --version - Check authentication:
gemini auth - Try with simpler prompt
- Report error to user with troubleshooting steps
Notes
- This is a fallback for sites Claude cannot access directly
- Gemini CLI must be installed and authenticated separately
- Response quality depends on Gemini's access to the site
- Some sites may still be inaccessible