Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/perplexityai/modelcontextprotocol/llms.txt

Use this file to discover all available pages before exploring further.

Overview

The perplexity_ask tool provides fast, AI-generated answers to questions using the Sonar Pro model with real-time web search. It’s the fastest and most cost-effective option for general Q&A, summaries, and explanations.
This tool uses the sonar-pro model, which balances speed, quality, and cost for everyday queries.

Use Cases

  • Quick factual questions
  • Summaries and explanations
  • General knowledge queries
  • Current events and news
  • Product comparisons
  • How-to guides

Parameters

messages
array
required
Array of conversation messages in OpenAI format.Each message must have:
  • role: One of "system", "user", or "assistant"
  • content: The message text (string)
Example:
[
  { "role": "user", "content": "What is Model Context Protocol?" }
]
search_recency_filter
enum
Filter search results by how recent they are.Options: "hour", "day", "week", "month", "year"
  • "hour": Very recent news (last 60 minutes)
  • "day": Today’s updates (last 24 hours)
  • "week": This week’s content
  • "month": This month’s content
  • "year": This year’s content
Example: "day"
search_domain_filter
array
Restrict or exclude specific domains from search results.
  • Include domains: ["wikipedia.org", "arxiv.org"]
  • Exclude domains: ["-reddit.com", "-pinterest.com"] (use - prefix)
Example: ["github.com", "stackoverflow.com"]
search_context_size
enum
Control how much web context is retrieved for answering.Options: "low", "medium", "high"
  • "low" (default): Fastest, uses minimal context
  • "medium": Balanced speed and context
  • "high": Most comprehensive, slower
Example: "medium"

Response Format

The tool returns an AI-generated text response with inline citation references:
response
string
AI-generated answer with numbered citation references [1], [2], etc.Citations are appended at the end in the format:
Citations:
[1] https://example.com/source1
[2] https://example.com/source2

Example Response

The Model Context Protocol (MCP) is an open standard that enables AI assistants 
to securely access data from various sources[1]. It was developed by Anthropic 
and released in November 2024[2]. MCP allows language models to interact with 
external tools, databases, and APIs through a standardized interface[1][3].

Citations:
[1] https://modelcontextprotocol.io/introduction
[2] https://anthropic.com/news/model-context-protocol
[3] https://github.com/modelcontextprotocol/docs

Usage Examples

const result = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      {
        role: "user",
        content: "What are the latest features in Python 3.13?"
      }
    ]
  }
);

Common Patterns

Breaking News Queries

Get the latest information on current events:
const news = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      { role: "user", content: "Latest developments in AI regulation" }
    ],
    search_recency_filter: "week"
  }
);

Academic Research

Focus on scholarly sources:
const research = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      { role: "user", content: "Recent breakthroughs in cancer immunotherapy" }
    ],
    search_domain_filter: ["arxiv.org", "pubmed.gov", "nature.com"],
    search_context_size: "high"
  }
);

Product Comparisons

Get unbiased comparisons without marketing sites:
const comparison = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      { role: "user", content: "Compare M3 vs M4 MacBook Pro performance" }
    ],
    search_domain_filter: ["-amazon.com", "-bestbuy.com"]
  }
);

Advanced Usage

System Prompts

Use system messages to guide the response format:
const result = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      {
        role: "system",
        content: "Provide concise, bullet-point answers with sources."
      },
      {
        role: "user",
        content: "What are the key benefits of TypeScript?"
      }
    ]
  }
);

Combining Filters

Use multiple filters for precise results:
const result = await use_mcp_tool(
  "perplexity",
  "perplexity_ask",
  {
    messages: [
      { role: "user", content: "Latest AI safety research papers" }
    ],
    search_recency_filter: "month",
    search_domain_filter: ["arxiv.org", "openai.com", "anthropic.com"],
    search_context_size: "high"
  }
);

Tips and Best Practices

Use recency filters for time-sensitive queries: Set search_recency_filter: "day" for breaking news or "hour" for very recent events.
Filter domains for quality: Use search_domain_filter to focus on authoritative sources like .edu, .gov, or trusted publications.
Increase context for complex topics: Set search_context_size: "high" when you need comprehensive coverage of a topic.
Keep conversations concise: While multi-turn conversations are supported, sonar-pro works best with focused, single-question interactions.
Filtering by very recent time periods (e.g., "hour") may return few or no results if there’s limited fresh content on your topic.

Comparison with Other Tools

Featureperplexity_askperplexity_researchperplexity_reason
Modelsonar-prosonar-deep-researchsonar-reasoning-pro
SpeedFast (< 5s)Slow (30s+)Medium (5-15s)
DepthStandardComprehensiveAnalytical
Best ForQuick Q&ADeep researchLogic & reasoning
Recency FilterYesNoYes
Domain FilterYesNoYes
Context SizeAdjustableHigh (default)Adjustable
perplexity_ask is the fastest and most cost-effective option. Use perplexity_research only when you need comprehensive, multi-source analysis.

Error Handling

Common errors and solutions:
  • Invalid messages array: Ensure each message has role and content fields
  • Invalid role: Must be "system", "user", or "assistant"
  • Empty content: Message content cannot be empty or null
  • Invalid recency filter: Must be one of: hour, day, week, month, year
  • Invalid context size: Must be one of: low, medium, high

Search Tool

Get raw search results without AI synthesis

Research Tool

Conduct deep, comprehensive multi-source research

Reason Tool

Use advanced reasoning for complex analytical tasks

Tools Overview

Compare all available tools and their capabilities

Build docs developers (and LLMs) love