Perplexity AI web search and chat via API. Operations: search (web-grounded answer with citations), chat (multi-turn conversation). Requires Perplexity API key.
perplexitysearchaiwebsearchrag
Input Parameters
Parameter
Type
Description
operationrequired
string
search: web-grounded answer with citations; chat: multi-turn conversation with messages array. One of: search, chat.
apiKeyrequired
string
Perplexity API key.
queryrequired
string
Question or search query. Required for search and single-turn chat.
modeloptional
string
Model to use (e.g. sonar, sonar-pro, sonar-reasoning). Default: sonar. Default: sonar.
maxTokensoptional
integer
Max tokens in response (default: 1024). Default: 1024.
temperatureoptional
number
Sampling temperature 0.0–2.0 (default: 0.2). Default: 0.2.
systemPromptoptional
string
System prompt to guide the response style.
messagesoptional
string
JSON array of chat messages for multi-turn chat: [{"role":"user","content":"..."}].
returnCitationsoptional
boolean
Include source citations in the response. Default: True.
returnImagesoptional
boolean
Include image results. Default: False.
searchDomainFilteroptional
string
Comma-separated domains to restrict search to.
searchRecencyFilteroptional
string
Restrict results to a time window. One of: , hour, day, week, month, year.
Output Fields
Field
Type
Description
answer
string
citations
array[string]
model
string
error
string
Examples
Web-grounded search
// Input
{
"operation": "search",
"apiKey": "your-key",
"query": "What is Model Context Protocol?"
}
// Output
{
"answer": "MCP is an open protocol...",
"citations": [
"https://..."
]
}
Install & Discovery
Install
ppm install mcp-perplexity
Get JSON Schema
GET /v1/packages/mcp-perplexity/1.0.0/schema
Discover by keyword
GET /v1/mcp/discover?q=perplexity
Discovery hint: Install with ppm install mcp-perplexity or invoke remotely via POST /v1/invoke/mcp-perplexity on the MCP Service.
PascalAI Usage
uses toolslib;
var Tool := LoadTool('mcp-perplexity');
var R := Tool.Call(JsonObj(['operation','search','apiKey','your-key','query','What is MCP?']));
Writeln(R.ToJSON);