keyapi-google-search
Perform Google web and image searches — retrieve ranked web results or search for images with geographic, language, and result-count controls.
This skill provides Google search intelligence using the KeyAPI MCP service. It enables keyword-based web search returning ranked results with titles, URLs, and snippets, and image search with country/language targeting and page-based pagination — all through a unified, cache-first workflow.
Use this skill when you need to:
- - Retrieve ranked Google web search results for any keyword query
- Search Google Images for visual content matching a keyword
- Target searches to a specific country or language
- Control result count (up to 100 for web, up to 20 per page for images)
- Paginate through image search results
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Prerequisites
| Requirement | Details |
|---|
| KEYAPITOKEN | A valid API token from keyapi.ai. Register at the site to obtain your free token. Set it as an environment variable: INLINECODE0 |
| Node.js |
v18 or higher |
|
Dependencies | Run
npm install in the skill directory to install
@modelcontextprotocol/sdk |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
MCP Server Configuration
All tool calls in this skill target the KeyAPI Google MCP server:
CODEBLOCK0
Setup (one-time):
CODEBLOCK1
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Analysis Scenarios
| User Need | Node(s) | Best For |
|---|
| Ranked web search results | INLINECODE3 | Content research, competitive analysis, SERP monitoring |
| Image search results |
image_search | Visual content discovery, brand image monitoring, asset research |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Workflow
Step 1 — Select the Right Search Node
- - Web content research: Use
web_search for any query requiring text results, URLs, and page snippets. - Visual content research: Use
image_search for queries requiring image URLs and visual asset discovery.
web_search — No Pagination
web_search returns results in a single call. Use the num parameter (1–100) to control how many results are returned. There is no page parameter — all results are delivered at once.
image_search — Page-Based Pagination
image_search supports page (1-indexed) and num (1–20 per page) for pagination. To retrieve more results, increment the page value while keeping num consistent.
Language and Region Targeting
The two endpoints use different parameter conventions for targeting:
| Endpoint | Language param | Format | Example |
|---|
| INLINECODE17 | INLINECODE18 | Language-region code | INLINECODE19 , zh-CN, INLINECODE21 |
| INLINECODE22 |
lr | Language prefix code | lang_en, lang_zh-CN, lang_de |
| image_search | gl | Two-letter country code | us, cn, de |
For web_search, lr controls both language and regional relevance. For image_search, use gl for country targeting and lr for language filtering — they are independent controls.
Step 2 — Retrieve API Schema
Before calling any node, inspect its input schema to confirm required parameters and available options:
CODEBLOCK2
Step 3 — Call APIs and Cache Results Locally
Execute tool calls and persist responses to the local cache to avoid redundant API calls.
Calling a tool:
CODEBLOCK3
Example — web search (English, US, top 10 results):
CODEBLOCK4
Example — web search (more results in one call):
CODEBLOCK5
Example — image search (first page):
CODEBLOCK6
Example — image search (next page):
CODEBLOCK7
Example — web search in a non-English market:
CODEBLOCK8
Pagination reference:
| Endpoint | Pagination | Notes |
|---|
| INLINECODE37 | None | Use num (1–100) to set result count. All results returned in one call. |
| INLINECODE39 |
page (1-indexed) | Use
num (1–20) per page. Increment
page for next batch. |
Parameter reference:
| Endpoint | Parameter | Description | Example values |
|---|
| Both | INLINECODE43 | Search query (required) | INLINECODE44 |
| INLINECODE45 |
num | Result count (1–100, default 10) |
10,
50,
100 |
|
web_search |
lr | Language and region (default
en-US) |
en-US,
zh-CN,
de-DE,
ja-JP |
|
image_search |
num | Results per page (1–20, default 10) |
10,
20 |
|
image_search |
page | Page number (1-indexed, default 1) |
1,
2,
3 |
|
image_search |
gl | Country code for geo-targeting (default
us) |
us,
uk,
de,
cn |
|
image_search |
lr | Language filter (default
lang_en) |
lang_en,
lang_zh-CN,
lang_de |
Cache directory structure:
CODEBLOCK9
Cache-first policy:
Before every API call, check whether a cached result already exists for the given parameters. If a valid cache file exists, load from disk and skip the API call.
Step 4 — Synthesize and Report Findings
After collecting all API responses, produce a structured search intelligence report:
For web search results:
- 1. SERP Overview — Total result count, top-ranking domains, result type distribution (organic, featured snippets, knowledge panels).
- Content Analysis — Key themes across top results, common title patterns, snippet sentiment.
- Competitive Landscape — Dominant domains, content authority signals, outranking opportunities.
- Research Findings — Synthesized answer from top results relevant to the query intent.
For image search results:
- 1. Image Inventory — Result count, image source domains, image type distribution (product photos, infographics, logos).
- Visual Themes — Common subjects, color patterns, composition styles.
- Source Attribution — Top domains providing images, licensing signals where available.
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Common Rules
| Rule | Detail |
|---|
web_search has no pagination | Use num (max 100) to retrieve all desired results in one call. There is no page parameter for web search. |
image_search pagination |
Use
page (1-indexed) with consistent
num to paginate through image results. |
|
lr format difference |
web_search uses
en-US format;
image_search uses
lang_en format. Do not mix them. |
|
gl is image-search only | The
gl country-targeting parameter is available on
image_search only, not
web_search. |
|
num limits |
web_search: 1–100.
image_search: 1–20 per page. |
|
Success check |
code = 0 → success. Any other value → failure. Always check the response code before processing data. |
|
Retry on 500 | If
code = 500, retry the identical request up to 3 times with a 2–3 second pause between attempts before reporting the error. |
|
Cache first | Always check the local
.keyapi-cache/ directory before issuing a live API call. |
author: KeyAPI
license: MIT
repository: https://github.com/EchoSell/keyapi-skills
Error Handling
| Code | Meaning | Action |
|---|
| INLINECODE100 | Success | Continue workflow normally |
| INLINECODE101 |
Bad request — invalid or missing parameters | Ensure
q is provided; check
num range (web: 1–100, image: 1–20); verify
lr format |
|
401 | Unauthorized — token missing or expired | Confirm
KEYAPI_TOKEN is set correctly; visit
keyapi.ai to renew |
|
403 | Forbidden — plan quota exceeded or feature restricted | Review plan limits at
keyapi.ai |
|
429 | Rate limit exceeded | Wait 60 seconds, then retry |
|
500 | Internal server error | Retry up to 3 times with a 2–3 second pause; if it persists, log the full request and response and skip this node |
| Other non-0 | Unexpected error | Log the full response body and surface the error message to the user |
keyapi-google-search
执行谷歌网页和图片搜索——检索排名后的网页结果,或通过地理位置、语言和结果数量控制进行图片搜索。
本技能通过KeyAPI MCP服务提供谷歌搜索智能。它支持基于关键词的网页搜索,返回包含标题、URL和摘要的排名结果;以及支持国家/语言定位和基于分页的图片搜索——全部通过统一的、缓存优先的工作流程实现。
当您需要以下功能时,请使用本技能:
- - 检索任何关键词查询的谷歌网页排名结果
- 搜索与关键词匹配的谷歌图片视觉内容
- 将搜索定位到特定国家或语言
- 控制结果数量(网页最多100条,图片每页最多20条)
- 对图片搜索结果进行分页
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
前提条件
| 要求 | 详情 |
|---|
| KEYAPITOKEN | 来自 keyapi.ai 的有效API令牌。在网站上注册以获取您的免费令牌。将其设置为环境变量:export KEYAPITOKEN=yourtoken_here |
| Node.js |
v18 或更高版本 |
|
依赖项 | 在技能目录中运行 npm install 以安装 @modelcontextprotocol/sdk |
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
MCP服务器配置
本技能中的所有工具调用均指向KeyAPI谷歌MCP服务器:
服务器URL:https://mcp.keyapi.ai/google/mcp
认证头:Authorization: Bearer $KEYAPI_TOKEN
设置(一次性):
bash
1. 安装依赖项
npm install
2. 设置您的API令牌(在 https://keyapi.ai/ 免费获取)
export KEYAPI
TOKEN=yourtoken_here
3. 列出所有可用工具以验证连接
node scripts/run.js --platform google --list-tools
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
分析场景
| 用户需求 | 节点 | 最佳用途 |
|---|
| 排名后的网页搜索结果 | websearch | 内容研究、竞争分析、SERP监控 |
| 图片搜索结果 |
imagesearch | 视觉内容发现、品牌形象监控、素材研究 |
作者:KeyAPI
许可证:MIT
仓库:https://github.com/EchoSell/keyapi-skills
工作流程
步骤1 — 选择正确的搜索节点
- - 网页内容研究:对于任何需要文本结果、URL和页面摘要的查询,使用 websearch。
- 视觉内容研究:对于需要图片URL和视觉素材发现的查询,使用 imagesearch。
web_search — 无分页
web_search 在单次调用中返回结果。使用 num 参数(1–100)控制返回的结果数量。没有 page 参数——所有结果一次性交付。
image_search — 基于页面的分页
image_search 支持 page(从1开始)和 num(每页1–20)进行分页。要检索更多结果,请在保持 num 一致的同时递增 page 值。
语言和区域定位
两个端点使用不同的参数约定进行定位:
| 端点 | 语言参数 | 格式 | 示例 |
|---|
| websearch | lr | 语言-区域代码 | en-US、zh-CN、de-DE |
| imagesearch |
lr | 语言前缀代码 | langen、langzh-CN、lang_de |
| image_search | gl | 两个字母的国家代码 | us、cn、de |
对于 websearch,lr 控制语言和区域相关性。对于 imagesearch,使用 gl 进行国家定位,使用 lr 进行语言过滤——它们是独立的控制。
步骤2 — 检索API模式
在调用任何节点之前,检查其输入模式以确认必需的参数和可用选项:
bash
node scripts/run.js --platform google --schema web_search
node scripts/run.js --platform google --schema image_search
步骤3 — 调用API并将结果本地缓存
执行工具调用并将响应持久化到本地缓存,以避免重复的API调用。
调用工具:
bash
单次调用,美化输出
node scripts/run.js --platform google --tool
\
--params --pretty
强制获取新数据,跳过缓存
node scripts/run.js --platform google --tool \
--params --no-cache --pretty
示例 — 网页搜索(英文,美国,前10条结果):
bash
node scripts/run.js --platform google --tool web_search \
--params {q:best noise cancelling headphones 2025,lr:en-US,num:10} --pretty
示例 — 网页搜索(单次调用更多结果):
bash
node scripts/run.js --platform google --tool web_search \
--params {q:competitor analysis tools,lr:en-US,num:50} --pretty
示例 — 图片搜索(第一页):
bash
node scripts/run.js --platform google --tool image_search \
--params {q:wireless earbuds product photography,gl:us,lr:lang_en,num:20,page:1} --pretty
示例 — 图片搜索(下一页):
bash
node scripts/run.js --platform google --tool image_search \
--params {q:wireless earbuds product photography,gl:us,lr:lang_en,num:20,page:2} --pretty
示例 — 非英语市场的网页搜索:
bash
node scripts/run.js --platform google --tool web_search \
--params {q:无线耳机推荐,lr:zh-CN,num:10} --pretty
分页参考:
| 端点 | 分页 | 备注 |
|---|
| websearch | 无 | 使用 num(1–100)设置结果数量。所有结果在单次调用中返回。 |
| imagesearch |
page(从1开始) | 每页使用 num(1–20)。递增 page 以获取下一批。 |
参数参考:
| 端点 | 参数 | 描述 | 示例值 |
|---|
| 两者 | q | 搜索查询(必需) | best headphones |
| web_search |
num | 结果数量(1–100,默认10) | 10、50、100 |
| web_search | lr | 语言和区域(默认 en-US) | en-US、zh-CN、de-DE、ja-JP |
| image_search | num | 每页结果数(1–20,默认10) | 10、20 |
| image_search | page | 页码(从1开始,默认1) | 1、2、3 |
| image_search | gl | 地理定位的国家代码(默认 us) | us、uk、de、cn |
| imagesearch | lr | 语言过滤器(默认 langen) | langen、langzh-CN、lang_de |
缓存目录结构:
.keyapi-cache/
└── YYYY-MM-DD/
├── web_search/
│ └── {params_hash}.json
└── image_search/
└── {params_hash}.json
缓存优先策略:
在每次API调用之前,检查给定参数是否已存在缓存结果。如果存在有效的缓存文件,则从磁盘加载并跳过API调用。
步骤4 — 综合并报告发现
收集所有API响应后,生成结构化的搜索情报报告:
对于网页搜索结果:
- 1. SERP概览 — 总结果数、排名靠前的域名、结果类型分布(自然结果、精选摘要、知识面板)。
- 内容分析 — 顶部结果中的关键主题、常见标题模式、摘要情感。
- 竞争格局 — 主导域名、内容权威信号、超越机会。
- 研究发现 — 根据查询意图从顶部结果综合得出的答案。
对于图片搜索结果:
- 1. 图片清单 — 结果数、图片来源域名、图片类型分布(产品照片、信息图