UNPKG

perplexity-mcp-server

Version:

A Perplexity API Model Context Protocol (MCP) server that unlocks Perplexity's search-augmented AI capabilities for LLM agents. Features robust error handling, secure input validation, and transparent reasoning with the showThinking parameter. Built with

85 lines (84 loc) 2.9 kB
/** * @fileoverview Defines the core logic, schemas, and types for the `perplexity_deep_research` tool. * This tool interfaces with the Perplexity API to perform exhaustive, multi-source research. * @module src/mcp-server/tools/perplexityDeepResearch/logic */ import { z } from 'zod'; import { RequestContext } from '../../../utils/index.js'; export declare const PerplexityDeepResearchInputSchema: z.ZodObject<{ query: z.ZodString; reasoning_effort: z.ZodDefault<z.ZodOptional<z.ZodEnum<["low", "medium", "high"]>>>; }, "strip", z.ZodTypeAny, { reasoning_effort: "low" | "medium" | "high"; query: string; }, { query: string; reasoning_effort?: "low" | "medium" | "high" | undefined; }>; export declare const PerplexityDeepResearchResponseSchema: z.ZodObject<{ rawResultText: z.ZodString; responseId: z.ZodString; modelUsed: z.ZodString; usage: z.ZodObject<{ prompt_tokens: z.ZodNumber; completion_tokens: z.ZodNumber; total_tokens: z.ZodNumber; }, "strip", z.ZodTypeAny, { prompt_tokens: number; completion_tokens: number; total_tokens: number; }, { prompt_tokens: number; completion_tokens: number; total_tokens: number; }>; searchResults: z.ZodOptional<z.ZodArray<z.ZodObject<{ title: z.ZodString; url: z.ZodString; date: z.ZodOptional<z.ZodNullable<z.ZodString>>; }, "strip", z.ZodTypeAny, { url: string; title: string; date?: string | null | undefined; }, { url: string; title: string; date?: string | null | undefined; }>, "many">>; }, "strip", z.ZodTypeAny, { usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; responseId: string; rawResultText: string; modelUsed: string; searchResults?: { url: string; title: string; date?: string | null | undefined; }[] | undefined; }, { usage: { prompt_tokens: number; completion_tokens: number; total_tokens: number; }; responseId: string; rawResultText: string; modelUsed: string; searchResults?: { url: string; title: string; date?: string | null | undefined; }[] | undefined; }>; export type PerplexityDeepResearchInput = z.infer<typeof PerplexityDeepResearchInputSchema>; export type PerplexityDeepResearchResponse = z.infer<typeof PerplexityDeepResearchResponseSchema>; /** * 3. IMPLEMENT and export the core logic function. * It must remain pure: its only concerns are its inputs and its return value or thrown error. * @throws {McpError} If the logic encounters an unrecoverable issue. */ export declare function perplexityDeepResearchLogic(params: PerplexityDeepResearchInput, context: RequestContext): Promise<PerplexityDeepResearchResponse>;