Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dvlpjrs/guMCP/llms.txt

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

The Perplexity server provides access to Perplexity AI’s search and chat capabilities, enabling web searches with recency filters and conversations with various Perplexity models.

Authentication

This server uses API key authentication.

Setup

  1. Obtain a Perplexity API key from Perplexity AI
  2. Run the authentication setup:
python src/servers/perplexity/main.py auth
  1. Enter your API key when prompted
The API key is stored securely in your local authentication configuration.

Models

The server supports these Perplexity models:
ModelDescription
sonarStandard search model (default)
sonar-proEnhanced search with better accuracy
sonar-deep-researchIn-depth research mode
sonar-reasoningReasoning-focused responses
sonar-reasoning-proAdvanced reasoning capabilities

Prompts

The server provides pre-configured prompts for common use cases.
Search with time-based filtering.Arguments:
  • query (required): The search query
  • recency (optional): Time filter - hour, day, week, month, year, or none
Example Usage:
Query: "latest AI developments"
Recency: week
Generates a prompt optimized for time-filtered web searches.
Get coding help from Perplexity.Arguments:
  • problem (required): The coding problem or question
  • language (optional): Programming language
Example Usage:
Problem: "How to implement binary search"
Language: Python
Generates a prompt optimized for code-related queries.

Tools

Send a message to a Perplexity model without forcing web search.Parameters:
  • message (string, required): The message to send
  • model (string, optional): Model to use (default: sonar)
  • system_prompt (string, optional): Custom system prompt (default: “Be helpful, concise, and precise.”)
  • temperature (number, optional): Randomness of responses, 0-2 (default: 0.7)
Example:
{
  "message": "Explain how neural networks work",
  "model": "sonar-reasoning",
  "system_prompt": "You are an expert AI educator. Explain concepts clearly with examples.",
  "temperature": 0.5
}
Search Context: Uses medium search context size for balanced performance.Temperature Guide:
  • 0.0-0.3: More focused and deterministic
  • 0.4-0.7: Balanced creativity and consistency
  • 0.8-2.0: More creative and varied responses

Recency Filters

Time-based filtering for search results:
FilterDescription
hourResults from the past hour
dayResults from the past 24 hours
weekResults from the past 7 days
monthResults from the past 30 days
yearResults from the past year
noneNo time filtering (default)

API Reference

Base URL: https://api.perplexity.ai

Key Endpoint

POST /chat/completions Request format:
{
  "model": "sonar",
  "messages": [
    {"role": "system", "content": "System prompt"},
    {"role": "user", "content": "User message"}
  ],
  "temperature": 0.7,
  "return_related_questions": false,
  "web_search_options": {
    "search_context_size": "high"
  },
  "search_recency_filter": "week"
}
Response format:
{
  "choices": [
    {
      "message": {
        "content": "Response text"
      }
    }
  ],
  "related_questions": ["Question 1", "Question 2"]
}

Features

  • Configurable search context size (medium/high)
  • Time-based filtering for recent information
  • Related questions for exploration
  • Model selection for different use cases

Chat

  • Flexible system prompts
  • Temperature control for response variety
  • Multiple specialized models
  • Medium search context for background information

Error Handling

The server handles:
  • Missing API key errors
  • Invalid model names (validates against supported models)
  • API rate limits and timeouts (60 second timeout)
  • HTTP error responses with status codes
  • Network failures
Errors are returned with descriptive messages including:
  • Status codes from Perplexity API
  • Error text from responses
  • Exception details for debugging

Best Practices

  1. Model Selection:
    • Use sonar for general searches
    • Use sonar-pro for higher accuracy needs
    • Use sonar-deep-research for comprehensive research
    • Use reasoning models for complex problem-solving
  2. Recency Filters:
    • Apply time filters for news and current events
    • Use none for timeless topics
    • Consider week or month as balanced defaults
  3. Temperature:
    • Lower (0.0-0.3) for factual, consistent responses
    • Medium (0.4-0.7) for balanced output
    • Higher (0.8-2.0) for creative tasks
  4. Related Questions:
    • Enable for exploratory research
    • Use to discover related topics
    • Helpful for user guidance