ClawSkills logoClawSkills

serper-search

通过 Serper.dev API 获取真实的 Google 搜索或新闻结果,包含链接、摘要、知识图谱数据和相关问题。

介绍

# Serper Google Search Plugin

通过 [Serper.dev](https://serper.dev) API 实现的原生 Clawdbot Google 搜索插件。作为单次工具调用,返回真实的 Google 结果 —— 包括自然链接、知识图谱、新闻和“People Also Ask”。

## 何时使用

- 您需要带有链接和摘要的**真实 Google 结果**(而非 AI 生成的答案) - 您想获取关于特定主题的 Google 新闻文章 - 您需要知识图谱数据(快速事实、实体信息) - 使用原始 Google 数据补充 AI 搜索工具(Perplexity, Brave)

## 设置

1. 在 [serper.dev](https://serper.dev) 获取免费 API 密钥(每月 2,500 次搜索,无需信用卡) 2. 在 Clawdbot 配置中设置环境变量:

```json { "env": { "vars": { "SERPER_API_KEY": "your-api-key-here" } } } ```

或直接在插件条目中配置:

```json { "plugins": { "entries": { "serper-search": { "enabled": true, "config": { "apiKey": "your-api-key-here", "defaultNumResults": 5 } } } } } ```

## 用法

该插件注册了一个名为 `serper_search` 的工具,包含三个参数:

| 参数 | 类型 | 默认值 | 描述 | |-----------|------|---------|-------------| | `query` | string | 必填 | 搜索查询 | | `num` | number | 5 | 结果数量 (1-100) | | `searchType` | string | "search" | `"search"` 用于网页,`"news"` 用于新闻 |

### 网页搜索

> 搜索 "best rust web frameworks 2026"

返回包含标题、链接、摘要和排名的自然结果,以及知识图谱和相关问题。

### 新闻搜索

> 搜索新闻 "AI regulation Europe"

返回包含标题、链接、摘要、日期和来源的新闻文章。

## 插件结构

``` serper-search/ clawdbot.plugin.json # Plugin manifest with configSchema package.json # NPM package config index.ts # Plugin implementation SKILL.md # This file ```

## 主要实现细节

- **导出**:`export default function register(api)` —— 而非对象 - **工具注册**:`api.registerTool(toolObject)` —— 直接注册,非回调 - **返回格式**:`{ content: [{ type: "text", text: JSON.stringify(results) }] }` - **依赖**:从 Clawdbot 自身的 node_modules 中符号链接 `@sinclair/typebox`

## 作者

由 [@Samoppakiks](https://github.com/Samoppakiks) 使用 Claude Code 构建。

更多产品