Xby Web Research Assistant

Other

一个提供网络研究和发现功能的综合模型上下文协议(MCP)服务器,包含13种工具用于搜索、爬取和分析网络内容。

Install

openclaw skills install @cainingnk/xby-web-research-assistant

网络研究助手

一个提供网络研究和发现功能的综合模型上下文协议(MCP)服务器,包含13种工具用于搜索、爬取和分析网络内容。


⚠️ 强制要求:API 密钥

此 Skill 必须配置 API 密钥才能使用。

  • 首次使用时,如果 .env 中没有 XBY_APIKEY必须使用 AskUserQuestion 工具向用户询问 API 密钥
  • 拿到用户提供的密钥后,调用 scripts.config.set_api_key(api_key) 保存,然后继续处理
  • 获取 API 密钥:https://xiaobenyang.com
  • 禁止在缺少 API 密钥时自行搜索或编造数据

工作流程(必须遵守)

你(大模型)是路由层,负责理解用户意图、选择工具、提取参数。代码只负责调用API。

用户输入 → 你选择工具 → 提取该工具需要的参数 → 调用 scripts.tools 中的函数 → 返回结果给用户

步骤

  1. 检查 API 密钥:如果 scripts.config.settings.api_key 为空,使用 AskUserQuestion 询问用户,拿到后调用 scripts.config.set_api_key(key) 保存
  2. 选择工具:根据用户意图从下方工具列表中选择对应的工具函数
  3. 提取参数:根据选中的工具,提取该工具需要的参数
  4. 调用工具:使用关键字参数调用 scripts.tools 中的函数,例如 scripts.tools.search_schools(score='520', province='北京', category='综合')
  5. 返回结果:将工具返回的 raw 数据整理后展示给用户

工具选择规则

根据用户意图选择对应的工具函数:

用户意图工具函数
Use this first to gather fresh web search results via the local SearXNG instance.scripts.tools.web_search
Fetch a URL with crawl4ai when you need the actual page text for quoting or analysis.scripts.tools.crawl_url
Look up package information from npm, PyPI, crates.io, or Go modules.

Returns version, downloads, license, dependencies, security status, and repository links. Use this to quickly evaluate libraries before adding them to your project.

Examples:

  • package_info("express", reasoning="Need web framework", registry="npm")
  • package_info("requests", reasoning="HTTP client for API", registry="pypi")
  • package_info("serde", reasoning="JSON serialization", registry="crates") | scripts.tools.package_info | | Search for code examples, tutorials, and technical articles.

Optimized for finding practical examples and learning resources. Can optionally filter by time range for the most recent content. Perfect for learning new APIs, finding usage patterns, or discovering how others solve specific technical problems.

Content Types:

  • 'code': GitHub repos, code snippets, gists, Stack Overflow code examples
  • 'articles': Blog posts, tutorials, documentation, technical articles
  • 'both': Mix of code and written content (default)

Time Ranges:

  • 'all': Search all available content (default, recommended for best results)
  • 'year', 'month', 'week', 'day': Filter to recent content only

Examples:

  • search_examples("FastAPI dependency injection examples", content_type="code")
  • search_examples("React hooks tutorial", content_type="articles", time_range="year")
  • search_examples("Rust lifetime examples", content_type="both") | scripts.tools.search_examples | | Search for high-quality stock images using Pixabay.

Returns royalty-free images that are safe to use. Perfect for finding photos, illustrations, and vector graphics for projects, presentations, or design work.

Image Types:

  • 'photo': Real photographs
  • 'illustration': Digital illustrations and artwork
  • 'vector': Vector graphics (SVG format available)
  • 'all': All types (default)

Examples:

  • search_images("mountain landscape", image_type="photo")
  • search_images("business icons", image_type="vector")
  • search_images("technology background", orientation="horizontal") | scripts.tools.search_images | | Search for packages by keywords or description across registries.

Use this to find packages that solve a specific problem or provide certain functionality. Perfect for discovering libraries when you know what you need but not the package name.

Examples:

  • package_search("web framework", reasoning="Need backend framework", registry="npm")
  • package_search("json parsing", reasoning="Data processing", registry="pypi") | scripts.tools.package_search | | Fetch GitHub repository information and health metrics.

Returns stars, forks, issues, recent activity, language, license, and description. Use this to evaluate open source projects before using them.

Examples:

  • github_repo("microsoft/vscode", reasoning="Evaluate editor project")
  • github_repo("https://github.com/facebook/react", reasoning="Research UI framework") | scripts.tools.github_repo | | Find solutions for error messages and stack traces from Stack Overflow and GitHub.

Takes an error message or stack trace and finds relevant solutions with code examples. Automatically detects language and framework, extracts key error information, and searches for the best solutions ranked by votes and relevance.

Perfect for:

  • Debugging production errors
  • Understanding cryptic error messages
  • Finding working code fixes
  • Learning from similar issues

Examples:

  • translate_error("TypeError: Cannot read property 'map' of undefined", reasoning="Debugging React app crash")
  • translate_error("CORS policy: No 'Access-Control-Allow-Origin' header", reasoning="Fixing API integration", framework="FastAPI")
  • translate_error("error[E0382]: borrow of moved value", reasoning="Learning Rust ownership", language="rust") | scripts.tools.translate_error | | Search and fetch official API documentation with examples and explanations.

Documentation-first approach: fetches human-written docs with context, examples, and best practices. Much more useful than OpenAPI specs alone.

Discovery strategy:

  1. Try common URL patterns (docs.{api}.com, {api}.com/docs, etc.)
  2. If patterns fail, search for "{api} API official documentation"
  3. Crawl discovered docs and extract relevant content

No hardcoded URLs - works for ANY API by discovering docs dynamically.

Examples:

  • api_docs("stripe", "create customer", reasoning="Setting up payments")
  • api_docs("github", "create repository", reasoning="Automating repo creation")
  • api_docs("spartan", "button component", reasoning="Learning UI library") | scripts.tools.api_docs | | Extract structured data from web pages.

Extracts tables, lists, or specific fields from HTML pages and returns structured data. Much more efficient than parsing full page text.

Extract Types:

  • "table": Extract HTML tables as list of dicts
  • "list": Extract lists (ul/ol/dl) as structured list
  • "fields": Extract specific elements using CSS selectors
  • "json-ld": Extract JSON-LD structured data
  • "auto": Automatically detect and extract structured content

Examples:

Automatically gathers information about each technology and presents a structured comparison to help make informed decisions.

Categories:

  • "framework": Web frameworks (React, Vue, Angular, etc.)
  • "library": JavaScript/Python/etc. libraries
  • "database": Databases (PostgreSQL, MongoDB, etc.)
  • "language": Programming languages (Python, Go, Rust, etc.)
  • "tool": Build tools, CLIs, etc. (Webpack, Vite, etc.)
  • "auto": Auto-detect category

Examples:

  • compare_tech(["React", "Vue", "Svelte"], reasoning="Choose framework for new project")
  • compare_tech(["PostgreSQL", "MongoDB"], category="database", reasoning="Database for user data")
  • compare_tech(["FastAPI", "Flask"], aspects=["performance", "learning_curve"], reasoning="Python web framework") | scripts.tools.compare_tech | | Get changelog and release notes for a package. | scripts.tools.get_changelog | | Check if an API service or platform is experiencing issues. | scripts.tools.check_service_status |

如果参数不完整,使用 AskUserQuestion 向用户询问缺失的参数。


工具函数说明


scripts.tools.web_search

工具描述:Use this first to gather fresh web search results via the local SearXNG instance.

参数定义

参数名称参数类型是否必填默认值描述
querystringtruenull
reasoningstringtruenull
categorystringfalse"general"null
max_resultsintegerfalse5.0null

scripts.tools.crawl_url

工具描述:Fetch a URL with crawl4ai when you need the actual page text for quoting or analysis.

参数定义

参数名称参数类型是否必填默认值描述
urlstringtruenull
reasoningstringtruenull
max_charsintegerfalse8000.0null

scripts.tools.package_info

工具描述: Look up package information from npm, PyPI, crates.io, or Go modules.

Returns version, downloads, license, dependencies, security status, and repository links. Use this to quickly evaluate libraries before adding them to your project.

Examples:

  • package_info("express", reasoning="Need web framework", registry="npm")
  • package_info("requests", reasoning="HTTP client for API", registry="pypi")
  • package_info("serde", reasoning="JSON serialization", registry="crates")

参数定义

参数名称参数类型是否必填默认值描述
namestringtruenull
reasoningstringtruenull
registrystringfalse"npm"null

scripts.tools.search_examples

工具描述: Search for code examples, tutorials, and technical articles.

Optimized for finding practical examples and learning resources. Can optionally filter by time range for the most recent content. Perfect for learning new APIs, finding usage patterns, or discovering how others solve specific technical problems.

Content Types:

  • 'code': GitHub repos, code snippets, gists, Stack Overflow code examples
  • 'articles': Blog posts, tutorials, documentation, technical articles
  • 'both': Mix of code and written content (default)

Time Ranges:

  • 'all': Search all available content (default, recommended for best results)
  • 'year', 'month', 'week', 'day': Filter to recent content only

Examples:

  • search_examples("FastAPI dependency injection examples", content_type="code")
  • search_examples("React hooks tutorial", content_type="articles", time_range="year")
  • search_examples("Rust lifetime examples", content_type="both")

参数定义

参数名称参数类型是否必填默认值描述
querystringtruenull
reasoningstringtruenull
content_typestringfalse"both"null
time_rangestringfalse"all"null
max_resultsintegerfalse5.0null

scripts.tools.search_images

工具描述: Search for high-quality stock images using Pixabay.

Returns royalty-free images that are safe to use. Perfect for finding photos, illustrations, and vector graphics for projects, presentations, or design work.

Image Types:

  • 'photo': Real photographs
  • 'illustration': Digital illustrations and artwork
  • 'vector': Vector graphics (SVG format available)
  • 'all': All types (default)

Examples:

  • search_images("mountain landscape", image_type="photo")
  • search_images("business icons", image_type="vector")
  • search_images("technology background", orientation="horizontal")

参数定义

参数名称参数类型是否必填默认值描述
querystringtruenull
reasoningstringtruenull
image_typestringfalse"all"null
orientationstringfalse"all"null
max_resultsintegerfalse10.0null

scripts.tools.package_search

工具描述: Search for packages by keywords or description across registries.

Use this to find packages that solve a specific problem or provide certain functionality. Perfect for discovering libraries when you know what you need but not the package name.

Examples:

  • package_search("web framework", reasoning="Need backend framework", registry="npm")
  • package_search("json parsing", reasoning="Data processing", registry="pypi")

参数定义

参数名称参数类型是否必填默认值描述
querystringtruenull
reasoningstringtruenull
registrystringfalse"npm"null
max_resultsintegerfalse5.0null

scripts.tools.github_repo

工具描述: Fetch GitHub repository information and health metrics.

Returns stars, forks, issues, recent activity, language, license, and description. Use this to evaluate open source projects before using them.

Examples:

参数定义

参数名称参数类型是否必填默认值描述
repostringtruenull
reasoningstringtruenull
include_commitsbooleanfalsetruenull

scripts.tools.translate_error

工具描述: Find solutions for error messages and stack traces from Stack Overflow and GitHub.

Takes an error message or stack trace and finds relevant solutions with code examples. Automatically detects language and framework, extracts key error information, and searches for the best solutions ranked by votes and relevance.

Perfect for:

  • Debugging production errors
  • Understanding cryptic error messages
  • Finding working code fixes
  • Learning from similar issues

Examples:

  • translate_error("TypeError: Cannot read property 'map' of undefined", reasoning="Debugging React app crash")
  • translate_error("CORS policy: No 'Access-Control-Allow-Origin' header", reasoning="Fixing API integration", framework="FastAPI")
  • translate_error("error[E0382]: borrow of moved value", reasoning="Learning Rust ownership", language="rust")

参数定义

参数名称参数类型是否必填默认值描述
error_messagestringtruenull
reasoningstringtruenull
languagenullfalsenull
frameworknullfalsenull
max_resultsintegerfalse5.0null

scripts.tools.api_docs

工具描述: Search and fetch official API documentation with examples and explanations.

Documentation-first approach: fetches human-written docs with context, examples, and best practices. Much more useful than OpenAPI specs alone.

Discovery strategy:

  1. Try common URL patterns (docs.{api}.com, {api}.com/docs, etc.)
  2. If patterns fail, search for "{api} API official documentation"
  3. Crawl discovered docs and extract relevant content

No hardcoded URLs - works for ANY API by discovering docs dynamically.

Examples:

  • api_docs("stripe", "create customer", reasoning="Setting up payments")
  • api_docs("github", "create repository", reasoning="Automating repo creation")
  • api_docs("spartan", "button component", reasoning="Learning UI library")

参数定义

参数名称参数类型是否必填默认值描述
api_namestringtruenull
reasoningstringtruenull
topicstringtruenull
max_resultsintegerfalse2.0null

scripts.tools.extract_data

工具描述: Extract structured data from web pages.

Extracts tables, lists, or specific fields from HTML pages and returns structured data. Much more efficient than parsing full page text.

Extract Types:

  • "table": Extract HTML tables as list of dicts
  • "list": Extract lists (ul/ol/dl) as structured list
  • "fields": Extract specific elements using CSS selectors
  • "json-ld": Extract JSON-LD structured data
  • "auto": Automatically detect and extract structured content

Examples:

参数定义

参数名称参数类型是否必填默认值描述
urlstringtruenull
reasoningstringtruenull
extract_typestringfalse"auto"null
selectorsnullfalsenull
max_itemsintegerfalse100.0null

scripts.tools.compare_tech

工具描述: Compare multiple technologies, frameworks, or libraries side-by-side.

Automatically gathers information about each technology and presents a structured comparison to help make informed decisions.

Categories:

  • "framework": Web frameworks (React, Vue, Angular, etc.)
  • "library": JavaScript/Python/etc. libraries
  • "database": Databases (PostgreSQL, MongoDB, etc.)
  • "language": Programming languages (Python, Go, Rust, etc.)
  • "tool": Build tools, CLIs, etc. (Webpack, Vite, etc.)
  • "auto": Auto-detect category

Examples:

  • compare_tech(["React", "Vue", "Svelte"], reasoning="Choose framework for new project")
  • compare_tech(["PostgreSQL", "MongoDB"], category="database", reasoning="Database for user data")
  • compare_tech(["FastAPI", "Flask"], aspects=["performance", "learning_curve"], reasoning="Python web framework")

参数定义

参数名称参数类型是否必填默认值描述
technologiesarraytruenull
reasoningstringtruenull
categorystringfalse"auto"null
aspectsnullfalsenull
max_results_per_techintegerfalse3.0null

scripts.tools.get_changelog

工具描述:Get changelog and release notes for a package.

参数定义

参数名称参数类型是否必填默认值描述
packagestringtruenull
reasoningstringtruenull
registrystringfalse"auto"null
max_releasesintegerfalse5.0null

scripts.tools.check_service_status

工具描述:Check if an API service or platform is experiencing issues.

参数定义

参数名称参数类型是否必填默认值描述
servicestringtruenull
reasoningstringtruenull


返回值处理

工具函数返回 dict 对象:

  • result["raw"] - API 原始返回数据(JSON),直接将此数据整理后展示给用户
  • result["success"] - 是否成功(True/False)
  • result["message"] - 状态消息

项目结构

xiaobenyang_gaokao_skill/
├── scripts/
│   ├── __init__.py
│   ├── config.py       # 配置管理 + set_api_key()
│   ├── call_api.py      # API 客户端 + call_api()
│   └── tools.py         # 工具函数(直接调用)
├── requirements.txt
└── SKILL.md

注意事项

  1. API 密钥是必需的,无密钥时必须通过 AskUserQuestion 询问用户
  2. 禁止在缺少 API 密钥时自行搜索或编造数据