Skip to content

Commit c165599

Browse files
committed
Enhance tool metadata
1 parent 05c45e6 commit c165599

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

index.ts

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { fetch as undiciFetch, ProxyAgent } from "undici";
1616
*/
1717
const PERPLEXITY_ASK_TOOL: Tool = {
1818
name: "perplexity_ask",
19+
title: "Ask Perplexity",
1920
description:
2021
"Engages in a conversation using the Sonar API. " +
2122
"Accepts an array of messages (each with a role and content) " +
@@ -44,6 +45,10 @@ const PERPLEXITY_ASK_TOOL: Tool = {
4445
},
4546
required: ["messages"],
4647
},
48+
annotations: {
49+
readOnlyHint: true,
50+
openWorldHint: true,
51+
},
4752
};
4853

4954
/**
@@ -52,6 +57,7 @@ const PERPLEXITY_ASK_TOOL: Tool = {
5257
*/
5358
const PERPLEXITY_RESEARCH_TOOL: Tool = {
5459
name: "perplexity_research",
60+
title: "Deep Research",
5561
description:
5662
"Performs deep research using the Perplexity API. " +
5763
"Accepts an array of messages (each with a role and content) " +
@@ -84,6 +90,10 @@ const PERPLEXITY_RESEARCH_TOOL: Tool = {
8490
},
8591
required: ["messages"],
8692
},
93+
annotations: {
94+
readOnlyHint: true,
95+
openWorldHint: true,
96+
},
8797
};
8898

8999
/**
@@ -92,6 +102,7 @@ const PERPLEXITY_RESEARCH_TOOL: Tool = {
92102
*/
93103
const PERPLEXITY_REASON_TOOL: Tool = {
94104
name: "perplexity_reason",
105+
title: "Advanced Reasoning",
95106
description:
96107
"Performs reasoning tasks using the Perplexity API. " +
97108
"Accepts an array of messages (each with a role and content) " +
@@ -124,6 +135,10 @@ const PERPLEXITY_REASON_TOOL: Tool = {
124135
},
125136
required: ["messages"],
126137
},
138+
annotations: {
139+
readOnlyHint: true,
140+
openWorldHint: true,
141+
},
127142
};
128143

129144
/**
@@ -132,9 +147,11 @@ const PERPLEXITY_REASON_TOOL: Tool = {
132147
*/
133148
const PERPLEXITY_SEARCH_TOOL: Tool = {
134149
name: "perplexity_search",
150+
title: "Search the Web",
135151
description:
136152
"Performs web search using the Perplexity Search API. " +
137-
"Returns ranked search results with titles, URLs, snippets, and metadata.",
153+
"Returns ranked search results with titles, URLs, snippets, and metadata. " +
154+
"Perfect for finding up-to-date facts, news, or specific information.",
138155
inputSchema: {
139156
type: "object",
140157
properties: {
@@ -161,6 +178,10 @@ const PERPLEXITY_SEARCH_TOOL: Tool = {
161178
},
162179
required: ["query"],
163180
},
181+
annotations: {
182+
readOnlyHint: true,
183+
openWorldHint: true,
184+
},
164185
};
165186

166187
// Retrieve the Perplexity API key from environment variables
@@ -455,13 +476,24 @@ export async function performSearch(
455476
// Initialize the server with tool metadata and capabilities
456477
const server = new Server(
457478
{
458-
name: "example-servers/perplexity-ask",
459-
version: "0.1.0",
479+
name: "io.github.perplexityai/mcp-server",
480+
version: "0.4.0",
460481
},
461482
{
462483
capabilities: {
463484
tools: {},
464485
},
486+
instructions: `You are the Perplexity MCP Server. Use these tools appropriately:
487+
488+
- perplexity_search: For quick web searches when you need current information or facts. Returns ranked search results.
489+
490+
- perplexity_ask: For general questions and conversational queries with real-time web search using the sonar-pro model.
491+
492+
- perplexity_research: For deep, comprehensive research requiring thorough analysis using the sonar-deep-research model. Use this for complex topics that require detailed investigation.
493+
494+
- perplexity_reason: For complex analytical tasks requiring advanced reasoning using the sonar-reasoning-pro model. Use this for logical problems, analysis, and decision-making.
495+
496+
When using perplexity_research or perplexity_reason, consider setting strip_thinking=true to save context tokens if the reasoning process isn't needed in the final output.`,
465497
}
466498
);
467499

0 commit comments

Comments
 (0)