> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/test/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/test/compute/mcpg/web-search/unifuncs.md).

# Unifuncs

## MCP 工具

### Web-Search（实时搜索）

#### 参数

**Header 参数**

* `Authorization` (string, 可选): | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `query` (string, 必需): | 示例值：`今日金价`
* `page` (integer, 可选): 页码，默认值为1 | 示例值：`1`
* `count` (integer, 可选): 每页结果数量（1-50），默认值为10 | 示例值：`5`
* `freshness` (string, 可选): 结果时效性，可选值：Day、Week、Month、Year
* `summary` (boolean, 可选): 是否返回摘要，默认值为true
* `includeImages` (boolean, 可选): 是否同时搜索图像，并在images提供结果，默认值为false
* `format` (string, 可选): 返回格式，可选值：json、markdown、md、text、txt，默认值为json

### Web-Reader（网页读取）

#### 参数

**Header 参数**

* `Authorization` (string, 可选): | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`https://mp.weixin.qq.com/s/wmoNh44A4ofkawPNVx_g6A`
* `format` (string, 可选): 返回格式，可选值：markdown、md、text、txt，默认为md | 示例值：`md`
* `liteMode` (boolean, 可选): 是否启用精简模式，精简模式下将对页面内容进行可读性修剪，只保留具备可读性的内容，默认为false
* `includeImages` (boolean, 可选): 是否包含图片，默认为true
* `onlyCSSSelectors` (array, 可选): 仅包含匹配CSS选择器的元素，如：\[".article\_content"]
* `waitForCSSSelectors` (array, 可选): 等待这些CSS选择器元素出现后再解析页面，如：\["#main", ".rich\_media\_content"]
* `excludeCSSSelectors` (array, 可选): 排除匹配CSS选择器的元素，如：\["#footer", ".copyright"]
* `linkSummary` (boolean, 可选): 是否将页面中所有链接追加到内容尾部，默认为false
* `ignoreCache` (boolean, 可选): 是否忽略缓存，对于同一URL我们通常会加密缓存一小段时间来加速访问，默认为false，缓存期内不计费
* `setCookie` (string, 可选): 设置Cookie，对于需要验证的页面，这很有用
* `readTimeout` (number, 可选): 抓取超时时间，单位为秒，默认为120秒（2分钟）
* `preserveSource` (boolean, 可选): 是否在提取内容的每个段落，添加原文出处，默认为false
* `temperature` (number, 可选): 提取内容时大模型生成内容的随机性，取值范围为0.0-1.5，默认为0.2
* `extractTimeout` (string, 可选): 提取主题（topic）相关内容超时时间，单位为秒，默认为120秒
* `topic` (string, 可选): 如果您只关注页面中某个主题的相关内容，设置这个参数，将会采用大模型提取相关内容（注意：这将会产生额外的大模型调用费用，价格为0.008元/千Token）

### MCP Cline 配置

此服务器需要通过您的 MCP 客户端进行配置。以下是不同环境下的示例：

需要替换你的租户ID和API Key（必需）

```
{
  "mcpServers": {
    "unifuncs": {
      "type": "streamable_http",
      "url": "https://mcp.ecn.ai/{租户ID}/unifuncs/mcp",
      "headers": {
        "Authorization": "Bearer 你的API Key"
      }
    }
  }
}
```

## API 接口

### Web-Search（实时搜索）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/unifuncs/api/web-search/search`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `query` (string, 必需): | 示例值：`今日金价`
* `page` (integer, 可选): 页码，默认值为1 | 示例值：`1`
* `count` (integer, 可选): 每页结果数量（1-50），默认值为10 | 示例值：`5`
* `freshness` (string, 可选): 结果时效性，可选值：Day、Week、Month、Year
* `summary` (boolean, 可选): 是否返回摘要，默认值为true
* `includeImages` (boolean, 可选): 是否同时搜索图像，并在images提供结果，默认值为false
* `format` (string, 可选): 返回格式，可选值：json、markdown、md、text、txt，默认值为json

#### 返回响应

* **200 成功**
  * Content-Type：`application/json`

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/unifuncs/api/web-search/search' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "query": "今日金价",
  "page": 1,
  "count": 5
}'
```

#### 响应示例

```json
{
    "code": 0,
    "data": {
        "images": [
            "..."
        ],
        "webPages": [
            "..."
        ]
    },
    "message": "<string>",
    "requestId": "<string>"
}
```

### Web-Reader（网页读取）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/unifuncs/api/web-reader/read`

#### 请求参数

**Header 参数**

* `Authorization` (string, 可选): | 示例值：`Bearer {{YOUR_API_KEY}}`

**Body 参数**

* `url` (string, 必需): | 示例值：`https://mp.weixin.qq.com/s/wmoNh44A4ofkawPNVx_g6A`
* `format` (string, 可选): 返回格式，可选值：markdown、md、text、txt，默认为md | 示例值：`md`
* `liteMode` (boolean, 可选): 是否启用精简模式，精简模式下将对页面内容进行可读性修剪，只保留具备可读性的内容，默认为false
* `includeImages` (boolean, 可选): 是否包含图片，默认为true
* `onlyCSSSelectors` (array, 可选): 仅包含匹配CSS选择器的元素，如：\[".article\_content"]
* `waitForCSSSelectors` (array, 可选): 等待这些CSS选择器元素出现后再解析页面，如：\["#main", ".rich\_media\_content"]
* `excludeCSSSelectors` (array, 可选): 排除匹配CSS选择器的元素，如：\["#footer", ".copyright"]
* `linkSummary` (boolean, 可选): 是否将页面中所有链接追加到内容尾部，默认为false
* `ignoreCache` (boolean, 可选): 是否忽略缓存，对于同一URL我们通常会加密缓存一小段时间来加速访问，默认为false，缓存期内不计费
* `setCookie` (string, 可选): 设置Cookie，对于需要验证的页面，这很有用
* `readTimeout` (number, 可选): 抓取超时时间，单位为秒，默认为120秒（2分钟）
* `preserveSource` (boolean, 可选): 是否在提取内容的每个段落，添加原文出处，默认为false
* `temperature` (number, 可选): 提取内容时大模型生成内容的随机性，取值范围为0.0-1.5，默认为0.2
* `extractTimeout` (string, 可选): 提取主题（topic）相关内容超时时间，单位为秒，默认为120秒
* `topic` (string, 可选): 如果您只关注页面中某个主题的相关内容，设置这个参数，将会采用大模型提取相关内容（注意：这将会产生额外的大模型调用费用，价格为0.008元/千Token）

#### 返回响应

* **200 成功**
  * Content-Type：`application/json`

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/unifuncs/api/web-reader/read' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "url": "https://mp.weixin.qq.com/s/wmoNh44A4ofkawPNVx_g6A",
  "format": "md"
}'
```

#### 响应示例

```json
{}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/test/compute/mcpg/web-search/unifuncs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
