mcpField
I
images-search

images-search

github.com/brave创意与媒体1921.7k 次安装11 周前更新
代码仓库

关于 images-search

通过 Brave Search API 搜索图片的技能,可返回图片元数据、缩略图和来源链接,并支持设置地区、结果数量、拼写检查及 SafeSearch。

主要功能

  1. 01通过 Brave API 搜索图片
  2. 02按国家和语言筛选
  3. 03结果数量最高设为 200
  4. 04选择严格或关闭 SafeSearch
  5. 05获取缩略图和图片元数据

适用场景

  1. 01为图库和情绪板寻找图片
  2. 02为文章补充相关图片
  3. 03为视觉分析获取图片结果

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/brave/brave-search-skills --skill images-search

安装后在 Claude Code 中输入/images-search确认已加载。

详细介绍

图片搜索

需要 API 密钥:在 https://api.search.brave.com 获取

套餐:包含在 Search 套餐中。请参阅 https://api-dashboard.search.brave.com/app/subscriptions/subscribe

快速入门(cURL)

基本搜索
curl -s "https://api.search.brave.com/res/v1/images/search?q=mountain+landscape" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}"
使用参数
curl -s "https://api.search.brave.com/res/v1/images/search" \
  -H "Accept: application/json" \
  -H "X-Subscription-Token: ${BRAVE_SEARCH_API_KEY}" \
  -G \
  --data-urlencode "q=northern lights photography" \
  --data-urlencode "country=US" \
  --data-urlencode "search_lang=en" \
  --data-urlencode "count=20" \
  --data-urlencode "safesearch=strict"

端点

GET https://api.search.brave.com/res/v1/images/search

身份验证:X-Subscription-Token: <API_KEY> 请求头

参数

参数类型必填默认值说明
qstring是-搜索查询(1-400 个字符,最多 50 个词)
countrystring否US搜索国家/地区(2 个字母的国家/地区代码或 ALL)
search_langstring否en至少 2 个字符的语言代码
countint否50返回的结果数量(1-200)
safesearchstring否strictoff 或 strict(图片搜索不支持 moderate)
spellcheckbool否true自动更正查询;更正后的查询位于 query.altered

响应格式

{
  "type": "images",
  "query": {
    "original": "mountain landscape",
    "altered": null,
    "spellcheck_off": false,
    "show_strict_warning": false
  },
  "results": [
    {
      "type": "image_result",
      "title": "Beautiful Mountain Landscape",
      "url": "https://example.com/mountain-photo",
      "source": "example.com",
      "page_fetched": "2025-09-15T10:30:00Z",
      "thumbnail": {
        "src": "https://imgs.search.brave.com/...",
        "width": 200,
        "height": 150
      },
      "properties": {
        "url": "https://example.com/images/mountain.jpg",
        "placeholder": "https://imgs.search.brave.com/placeholder/...",
        "width": 1920,
        "height": 1080
      },
      "meta_url": {
        "scheme": "https",
        "netloc": "example.com",
        "hostname": "example.com",
        "favicon": "https://imgs.search.brave.com/favicon/...",
        "path": "/mountain-photo"
      },
      "confidence": "high"
    }
  ],
  "extra": {
    "might_be_offensive": false
  }
}

响应字段

字段类型说明
typestring始终为 "images"
query.originalstring原始查询
query.alteredstring?拼写检查后的查询(如果未更正则为 null)
query.spellcheck_offbool?是否已禁用拼写检查
query.show_strict_warningbool?strict 安全搜索隐藏了相关结果时为 True
results[]array图片结果列表
results[].typestring始终为 "image_result"
results[].titlestring?图片标题
results[].urlstring?找到图片的页面 URL
results[].sourcestring?来源域名
results[].page_fetchedstring?上次抓取页面的 ISO 日期时间
results[].thumbnail.srcstring?Brave 代理的缩略图 URL(宽约 500px)
results[].thumbnail.widthint?缩略图宽度
results[].thumbnail.heightint?缩略图高度
results[].properties.urlstring?原始全尺寸图片 URL
results[].properties.placeholderstring?低分辨率占位图 URL(由 Brave 代理)
results[].properties.widthint?原始图片宽度(可能为 null)
results[].properties.heightint?原始图片高度(可能为 null)
results[].meta_url.schemestring?URL 协议方案
results[].meta_url.netlocstring?网络位置
results[].meta_url.hostnamestring?转为小写的域名
results[].meta_url.faviconstring?网站图标 URL
results[].meta_url.pathstring?URL 路径
results[].confidencestring?相关性:low、medium 或 high
extra.might_be_offensivebool结果是否可能包含冒犯性内容

使用场景

  • 发现视觉内容:构建图片库、情绪板或视觉研究工具。使用 count=200 获取全面的结果。需要图片专属元数据(尺寸、缩略图)时,优先于 web-search 使用。
  • 丰富内容:为文章或生成的内容添加相关图片。使用 country 和 search_lang 来定位受众所在地区。
  • 安全地检索图片:默认的 safesearch=strict 可确保结果适合全家浏览。仅有两种模式(off/strict),没有 moderate 选项,这与网页、视频和新闻搜索不同。
  • 大批量检索:每次请求最多可返回 200 张图片(网页搜索为 20 条,视频/新闻搜索为 50 条)。非常适合批量收集图片或视觉分析流水线。

注意事项

  • SafeSearch:图片搜索默认为 strict(比网页搜索更严格)
  • 大批量:每次请求最多可返回 200 条结果
  • 缩略图:由 Brave 代理,以保护用户隐私(宽 500px)。原始全分辨率图片请使用 properties.url。
  • 尺寸:部分图片可能没有 properties.width/height
  • 占位图:properties.placeholder 是低分辨率 URL(不是内嵌 base64),可用于渐进式加载体验

评论

支持 Markdown