Skip to main content
Glama
RossH121

Perplexity MCP Server

model_info

View available AI models and their specializations, or manually override model selection to match specific query types like research, reasoning, or general search.

Instructions

View available Perplexity models and their specializations, or manually override model selection. By default, models are auto-selected based on query intent (research, reasoning, general search).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNoOptional: Override auto-selection. 'sonar-deep-research' for comprehensive analysis, 'sonar-reasoning-pro' for complex logic, 'sonar' for quick lookups

Implementation Reference

  • ModelInfoHandler class that executes the 'model_info' tool logic: validates input, sets or resets model and auto-selection, builds and returns detailed model information text.
    export class ModelInfoHandler { constructor( private modelSelectionService: ModelSelectionService, private config: EnvironmentConfig, private getCurrentModel: () => string, private setCurrentModel: (model: string) => void, private getUseAutoSelection: () => boolean, private setUseAutoSelection: (value: boolean) => void ) {} async handle(request: McpRequest) { if (!isValidModelArgs(request.params.arguments)) { throw ErrorHandler.createMcpError( ErrorCode.InvalidParams, "Invalid model argument. Model must be one of the valid models or not provided." ); } // If a specific model is requested, set it and disable auto-selection const { model } = request.params.arguments as ModelArgs; if (model) { this.setCurrentModel(model); this.setUseAutoSelection(false); } else { // If no model specified, reset to default and re-enable auto-selection this.setCurrentModel(this.config.defaultModel); this.setUseAutoSelection(true); } // Build model information text const modelInfoLines: string[] = []; // Current model status if (model) { modelInfoLines.push(`Model has been set to: ${this.getCurrentModel()}`); modelInfoLines.push( "Auto-selection: DISABLED (will only switch if query has strong intent matching)" ); modelInfoLines.push( "To re-enable auto-selection, run model_info with no parameters" ); modelInfoLines.push(""); } else { modelInfoLines.push( `Current model: ${this.getCurrentModel()} (reset to default)` ); modelInfoLines.push(`Default model (from environment): ${this.config.defaultModel}`); modelInfoLines.push( "Auto-selection: ENABLED (model will be selected based on query keywords)" ); modelInfoLines.push(""); } // List available models with descriptions modelInfoLines.push("Available models:"); for (const [modelName, criteria] of Object.entries(MODEL_SELECTION_MAP)) { modelInfoLines.push(`- ${modelName}: ${criteria.description}`); modelInfoLines.push(` Keywords: ${criteria.keywords.join(", ")}`); } // Instructions modelInfoLines.push(""); modelInfoLines.push( "To use automatic model selection: Call this tool with no parameters" ); modelInfoLines.push( 'To set a specific model: Use this tool with the "model" parameter' ); return { content: [ { type: "text", text: modelInfoLines.join("\n"), }, ], }; } }
  • MCP tool schema for 'model_info' defining the tool name, description, and input schema with optional 'model' parameter enum from VALID_MODELS.
    { name: "model_info", description: "View available Perplexity models and their specializations, or manually override model selection. By default, models are auto-selected based on query intent (research, reasoning, general search).", inputSchema: { type: "object", properties: { model: { type: "string", enum: VALID_MODELS, description: "Optional: Override auto-selection. 'sonar-deep-research' for comprehensive analysis, 'sonar-reasoning-pro' for complex logic, 'sonar' for quick lookups", }, }, }, },
  • Tool dispatch switch in CallToolRequestSchema handler that routes 'model_info' calls to ModelInfoHandler.handle().
    switch (request.params.name) { case "search": return this.searchHandler.handle(request); case "domain_filter": return this.domainFilterHandler.handle(request); case "recency_filter": return this.recencyFilterHandler.handle(request); case "clear_filters": return this.filterManagementHandler.handleClearFilters(); case "list_filters": return this.filterManagementHandler.handleListFilters(); case "model_info": return this.modelInfoHandler.handle(request); default: throw new McpError( ErrorCode.MethodNotFound, `Unknown tool: ${request.params.name}` ); } });
  • ListToolsRequestSchema handler that returns TOOL_SCHEMAS including the 'model_info' tool schema.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOL_SCHEMAS,
  • TypeScript interface for ModelArgs used in model_info handler for type safety.
    export interface ModelArgs {

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RossH121/perplexity-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server