> 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/perplexity.md).

# Perplexity

来自Perplexity的搜索API

## MCP 工具

### Search（搜索）

来自Perplexity的搜索API

#### 参数

**Header 参数**

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

**Body 参数**

* `query` (string, 必需): | 示例值：`latest AI developments 2025`
* `country` (string, 可选): Country code to filter search results by geographic location (e.g., 'US', 'GB', 'DE').
* `max_results` (integer, 可选): default:10 The maximum number of search results to return. Required range: 1 <= x <= 20
* `max_tokens_per_page` (integer, 可选): default:1024 Controls the maximum number of tokens retrieved from each webpage during search processing. Higher values provide more comprehensive content extraction but may increase processing time.
* `max_tokens` integerdefault:10000 Maximum tokens for context. Required range: 1 <= x <= 1000000 ​
* `max_tokens_per_page` integerdefault:4096 Maximum tokens per page. Required range: 1 <= x <= 1000000 ​
* `search_language_filter` string\[] ISO 639-1 language codes (2-character max) Maximum array length: 20 Required string length: 2 ​
* `search_domain_filter` string\[] Limit search results to specific domains (max 20) Maximum array length: 20 Maximum string length: 253 ​
* `last_updated_after_filter` string Return results updated after this date (MM/DD/YYYY)
* `last_updated_before_filter` string Return results updated before this date (MM/DD/YYYY) ​
* `search_after_date_filter` string Return results published after this date (MM/DD/YYYY)
* `search_before_date_filter` string Return results published before this date (MM/DD/YYYY)
* `search_recency_filter` enum Filter by publication recency (hour/day/week/month/year) Available options: hour, day, week, month, year

### MCP Cline 配置

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

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

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

## API 接口

### Search（搜索）

#### 请求信息

* **Method**: POST
* **Endpoint**: `/perplexity/search`

#### 请求参数

**Header 参数**

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

**Body 参数**

* `query` (string, 必需): | 示例值：`latest AI developments 2025`
* `country` (string, 可选): Country code to filter search results by geographic location (e.g., 'US', 'GB', 'DE').
* `max_results` (integer, 可选): default:10 The maximum number of search results to return. Required range: 1 <= x <= 20
* `max_tokens_per_page` (integer, 可选): default:1024 Controls the maximum number of tokens retrieved from each webpage during search processing. Higher values provide more comprehensive content extraction but may increase processing time.
* `max_tokens` integerdefault:10000 Maximum tokens for context. Required range: 1 <= x <= 1000000 ​
* `max_tokens_per_page` integerdefault:4096 Maximum tokens per page. Required range: 1 <= x <= 1000000 ​
* `search_language_filter` string\[] ISO 639-1 language codes (2-character max) Maximum array length: 20 Required string length: 2 ​
* `search_domain_filter` string\[] Limit search results to specific domains (max 20) Maximum array length: 20 Maximum string length: 253 ​
* `last_updated_after_filter` string Return results updated after this date (MM/DD/YYYY)
* `last_updated_before_filter` string Return results updated before this date (MM/DD/YYYY) ​
* `search_after_date_filter` string Return results published after this date (MM/DD/YYYY)
* `search_before_date_filter` string Return results published before this date (MM/DD/YYYY)
* `search_recency_filter` enum Filter by publication recency (hour/day/week/month/year) Available options: hour, day, week, month, year

#### 返回响应

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

#### 请求示例

```
curl --location --request POST 'https://api.ecn.ai/perplexity/search' \
	--header 'Content-Type: application/json' \
	--header 'Authorization: Bearer {{YOUR_API_KEY}}' \
	--data-raw '{
  "query": "latest AI developments 2025"
}'
```

#### 响应示例

```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/perplexity.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.
