Skip to content

Commit ac3b8fd

Browse files
feat: add search_type to perplexity_search for Fast Search (v1.3.0)
1 parent c73c856 commit ac3b8fd

10 files changed

Lines changed: 32 additions & 17 deletions

File tree

‎.claude-plugin/marketplace.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
},
77
"metadata": {
88
"description": "Official Perplexity AI plugin providing real-time web search, reasoning, and research capabilities",
9-
"version": "1.2.1"
9+
"version": "1.3.0"
1010
},
1111
"plugins": [
1212
{
1313
"name": "perplexity",
1414
"source": "./",
1515
"description": "Real-time web search, reasoning, and research through Perplexity's API",
16-
"version": "1.2.1",
16+
"version": "1.3.0",
1717
"author": {
1818
"name": "Perplexity AI",
1919
"email": "api@perplexity.ai"

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ The server will be accessible at `http://localhost:8080/mcp`
153153
## Available Tools
154154

155155
### **perplexity_search**
156-
Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`) and domain restrictions (`search_domain_filter`).
156+
Direct web search using the Perplexity Search API. Returns ranked search results with metadata, perfect for finding current information. Supports recency filters (`search_recency_filter`), domain restrictions (`search_domain_filter`), and [Fast Search](https://docs.perplexity.ai/docs/search/fast-search) (`search_type: "fast"`) for lower latency and cost.
157157

158158
### **perplexity_ask**
159159
General-purpose conversational AI with real-time web search, backed by the Agent API `fast` preset. Great for quick questions and everyday searches.

‎package-lock.json‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@perplexity-ai/mcp-server",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"mcpName": "ai.perplexity/mcp-server",
55
"description": "Real-time web search, reasoning, and research through Perplexity's API",
66
"keywords": [

‎plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
33
"name": "perplexity",
4-
"version": "1.2.1",
4+
"version": "1.3.0",
55
"description": "Real-time web search, reasoning, and research through Perplexity's API",
66
"author": {
77
"name": "Perplexity AI",

‎server.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"name": "ai.perplexity/mcp-server",
44
"title": "Perplexity API Platform",
55
"description": "Real-time web search, reasoning, and research through Perplexity's API",
6-
"version": "1.2.1",
6+
"version": "1.3.0",
77
"packages": [
88
{
99
"registryType": "npm",
1010
"identifier": "@perplexity-ai/mcp-server",
11-
"version": "1.2.1",
11+
"version": "1.3.0",
1212
"transport": {
1313
"type": "stdio"
1414
}

‎src/index.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ describe("Perplexity MCP Server", () => {
127127
headers: {
128128
"Content-Type": "application/json",
129129
Authorization: "Bearer test-api-key",
130-
"User-Agent": "perplexity-mcp/1.2.1",
130+
"User-Agent": "perplexity-mcp/1.3.0",
131131
"X-Source": "pplx-mcp-server",
132-
"X-Pplx-Integration": "perplexity-mcp/1.2.1",
132+
"X-Pplx-Integration": "perplexity-mcp/1.3.0",
133133
},
134134
body: JSON.stringify({
135135
preset: "fast",

‎src/server.ts‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import type {
99
AgentCallHooks,
1010
ApiKeyProvider,
1111
PerplexityServerOptions,
12+
SearchOptions,
1213
SearchResponse,
14+
SearchType,
1315
UndiciRequestOptions
1416
} from "./types.js";
1517
import { AgentResponseSchema, SearchResponseSchema } from "./validation.js";
@@ -18,7 +20,7 @@ export type { ApiKeyProvider, PerplexityServerOptions } from "./types.js";
1820

1921
const PERPLEXITY_API_KEY = process.env.PERPLEXITY_API_KEY;
2022
const PERPLEXITY_BASE_URL = process.env.PERPLEXITY_BASE_URL || "https://api.perplexity.ai";
21-
const VERSION = "1.2.1";
23+
const VERSION = "1.3.0";
2224

2325
// Agent API presets backing each tool: https://docs.perplexity.ai/docs/agent-api/presets
2426
export const ASK_PRESET = "fast";
@@ -481,7 +483,7 @@ export async function performSearch(
481483
maxResults: number = 10,
482484
maxTokensPerPage: number = 1024,
483485
country?: string,
484-
filters?: Pick<AgentToolOptions, "search_recency_filter" | "search_domain_filter">,
486+
filters?: SearchOptions,
485487
serviceOrigin?: string,
486488
apiKey?: ApiKeyProvider,
487489
): Promise<string> {
@@ -492,6 +494,7 @@ export async function performSearch(
492494
...(country && { country }),
493495
...(filters?.search_recency_filter && { search_recency_filter: filters.search_recency_filter }),
494496
...(filters?.search_domain_filter && { search_domain_filter: filters.search_domain_filter }),
497+
...(filters?.search_type && { search_type: filters.search_type }),
495498
};
496499

497500
const response = await makeApiRequest("search", body, serviceOrigin, undefined, apiKey);
@@ -547,7 +550,7 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P
547550
{
548551
instructions:
549552
"Perplexity AI server for web-grounded search, research, and reasoning, backed by the Perplexity Agent API. " +
550-
"Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters and domain restrictions. " +
553+
"Use perplexity_search for finding URLs, facts, and recent news. Supports recency filters, domain restrictions, and fast search. " +
551554
"Use perplexity_ask for quick AI-answered questions with citations. Supports recency filters, domain restrictions, and search context size control. " +
552555
"Use perplexity_research for in-depth multi-source investigation (slow, can take minutes). " +
553556
"Use perplexity_reason for complex analysis requiring step-by-step logic. Supports recency filters, domain restrictions, and search context size control. " +
@@ -727,6 +730,8 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P
727730
.describe("ISO 3166-1 alpha-2 country code for regional results (e.g., 'US', 'GB')"),
728731
search_recency_filter: searchRecencyFilterField,
729732
search_domain_filter: searchDomainFilterField,
733+
search_type: z.enum(["web", "fast"]).optional()
734+
.describe("Search backend. 'web' (default) is the standard web search. 'fast' is lower latency and lower cost; prefer it for routine lookups inside agent loops, and keep 'web' for rare or ambiguous questions."),
730735
};
731736

732737
const searchOutputSchema = {
@@ -740,7 +745,7 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P
740745
description: "Search the web and return a ranked list of results with titles, URLs, snippets, and dates. " +
741746
"Best for: finding specific URLs, checking recent news, verifying facts, discovering sources. " +
742747
"Returns formatted results (title, URL, snippet, date) with no AI synthesis. " +
743-
"Supports recency filters and domain restrictions. " +
748+
"Supports recency filters, domain restrictions, and a lower-latency fast search mode. " +
744749
"For AI-generated answers with citations, use perplexity_ask instead.",
745750
inputSchema: searchInputSchema as any,
746751
outputSchema: searchOutputSchema as any,
@@ -752,20 +757,22 @@ export function createPerplexityServer(serviceOrigin?: string, serverOptions?: P
752757
},
753758
},
754759
async (args: any) => {
755-
const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter } = args as {
760+
const { query, max_results, max_tokens_per_page, country, search_recency_filter, search_domain_filter, search_type } = args as {
756761
query: string;
757762
max_results?: number;
758763
max_tokens_per_page?: number;
759764
country?: string;
760765
search_recency_filter?: "hour" | "day" | "week" | "month" | "year";
761766
search_domain_filter?: string[];
767+
search_type?: SearchType;
762768
};
763769
const maxResults = typeof max_results === "number" ? max_results : 10;
764770
const maxTokensPerPage = typeof max_tokens_per_page === "number" ? max_tokens_per_page : 1024;
765771
const countryCode = typeof country === "string" ? country : undefined;
766-
const filters = {
772+
const filters: SearchOptions = {
767773
...(search_recency_filter && { search_recency_filter }),
768774
...(search_domain_filter && { search_domain_filter }),
775+
...(search_type && { search_type }),
769776
};
770777

771778
const result = await performSearch(query, maxResults, maxTokensPerPage, countryCode, filters, serviceOrigin, serverOptions?.apiKey);

‎src/transport.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,7 @@ describe("Transport Integration Tests", () => {
422422
query: "test",
423423
search_recency_filter: "week",
424424
search_domain_filter: ["wikipedia.org", "-reddit.com"],
425+
search_type: "fast",
425426
},
426427
});
427428

@@ -433,6 +434,7 @@ describe("Transport Integration Tests", () => {
433434
query: "test",
434435
search_recency_filter: "week",
435436
search_domain_filter: ["wikipedia.org", "-reddit.com"],
437+
search_type: "fast",
436438
});
437439
} finally {
438440
await client.close();

‎src/types.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ export interface SearchRequestBody {
8686
country?: string;
8787
}
8888

89+
export type SearchType = "web" | "fast";
90+
91+
export interface SearchOptions extends Pick<AgentToolOptions, "search_recency_filter" | "search_domain_filter"> {
92+
search_type?: SearchType;
93+
}
94+
8995
export interface AgentToolOptions {
9096
search_recency_filter?: "hour" | "day" | "week" | "month" | "year";
9197
search_domain_filter?: string[];

0 commit comments

Comments
 (0)