Google Search Skill
Overview
This Skill enables Claude to perform Google searches using the google_search_tool command-line interface. It retrieves current web information, making it ideal for answering questions that require up-to-date data, recent news, or information beyond Claude's knowledge cutoff.
When to Use This Skill
Use this Skill when:
- •Users ask for current events, news, or recent information
- •Questions require the latest technical documentation or API references
- •Looking up current prices, statistics, or data
- •Finding resources, tutorials, or guides on specific topics
- •Verifying facts or getting multiple perspectives from web sources
- •Users explicitly request a web search or Google search
Instructions
When performing a web search, follow these steps:
1. Identify the Search Query
- •Extract the key search terms from the user's request
- •Formulate a clear, concise search query
- •Use specific keywords for better results
- •Include relevant technical terms, product names, or specific phrases
2. Execute the Search
Run the search using the google_search_tool:
python -m google_search_tool "your search query" --pretty
Options:
- •Use
--prettyfor formatted JSON output (easier to read) - •Use
-n <number>to specify number of results (1-10, default: 10) - •For focused searches, use
-n 3or-n 5
Examples:
# General search with 5 results python -m google_search_tool "Python 3.13 new features" -n 5 --pretty # Focused search with 3 results python -m google_search_tool "React hooks tutorial" -n 3 --pretty # Full search with 10 results python -m google_search_tool "machine learning frameworks comparison" --pretty
3. Parse and Present Results
After receiving the search results:
- •Check for errors: If the output contains
"error", explain the error to the user - •Extract key information: Parse the JSON output for
title,link, andsnippet - •Summarize findings: Provide a concise summary of what you found
- •Present sources: List relevant results with titles and links
- •Answer the question: Use the search results to answer the user's original question
Presentation format:
Based on my search for "[query]", here's what I found: [Summary of findings based on search results] Key resources: 1. **[Title 1]** - [Brief description from snippet] [URL] 2. **[Title 2]** - [Brief description from snippet] [URL] [Additional context or recommendations]
4. Handle Edge Cases
No results found:
{
"results": [],
"count": 0
}
- •Inform the user that no results were found
- •Suggest trying different search terms
- •Offer to search with alternative queries
API error:
{
"error": "Error message"
}
- •Check if environment variables are set (GOOGLE_API_KEY, GOOGLE_CSE_ID)
- •Explain the error to the user
- •Suggest troubleshooting steps if applicable
Timeout or network error:
- •Inform the user of the issue
- •Offer to retry the search
- •Suggest checking network connectivity
5. Follow-up Searches
If the initial search doesn't fully answer the question:
- •Refine the search query based on initial results
- •Perform additional targeted searches
- •Combine information from multiple searches
Examples
Example 1: Current Events
User request: "What are the latest developments in AI this week?"
Steps:
- •Search:
python -m google_search_tool "latest AI developments 2025" -n 5 --pretty - •Parse the JSON results
- •Summarize key developments from the snippets
- •Present with source links
Example 2: Technical Documentation
User request: "How do I use React Server Components?"
Steps:
- •Search:
python -m google_search_tool "React Server Components guide" -n 5 --pretty - •Identify official documentation and tutorials
- •Extract key concepts from snippets
- •Provide overview with links to detailed resources
Example 3: Comparison Research
User request: "Compare PostgreSQL vs MySQL for large-scale applications"
Steps:
- •Search:
python -m google_search_tool "PostgreSQL vs MySQL large scale comparison" -n 5 --pretty - •Gather multiple perspectives from results
- •Synthesize comparisons from different sources
- •Present balanced view with source attribution
Important Notes
Environment Setup
The google_search_tool requires:
- •
GOOGLE_API_KEY: Google Cloud API key - •
GOOGLE_CSE_ID: Custom Search Engine ID - •These should be set in the
.envfile in the project root
Limitations
- •Maximum 10 results per search
- •API rate limits apply (check Google CSE quotas)
- •Results depend on Google's indexing and ranking
- •Snippets are truncated (may not contain full context)
Best Practices
- •Be specific: Use precise search terms for better results
- •Verify sources: Check that URLs and snippets are relevant before citing
- •Cite properly: Always include source URLs when presenting information
- •Respect recency: Recent results may be more relevant for time-sensitive queries
- •Multiple searches: For complex topics, perform several targeted searches rather than one broad search
Troubleshooting
If searches fail:
- •Verify the google_search_tool is installed:
pip show google-search-mcp - •Check environment variables are set in
.env - •Test manually:
python -m google_search_tool "test query" --pretty - •Review API quota limits in Google Cloud Console
- •Check network connectivity
Integration with Other Tools
This Skill works well alongside:
- •Read tool: After finding URLs, read local documentation
- •WebFetch tool: Retrieve full content from found URLs
- •Write tool: Save search results for later reference