Skip to content

Commit 61fda83

Browse files
Enhance query descriptions in PerplexityServer to emphasize the importance of specificity. Updated prompts for search, reasoning, and research queries to instruct users on including detailed context, error messages, and relevant information for more accurate responses.
1 parent 617f5a1 commit 61fda83

2 files changed

Lines changed: 37 additions & 22 deletions

File tree

.roo/mcp.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"mcpServers": {}
3+
}

src/index.ts

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class PerplexityServer {
206206
properties: {
207207
query: {
208208
type: "string",
209-
description: "The search query or question"
209+
description: "The search query or question. IMPORTANT: Be extremely specific and include all relevant details:\n- Include exact error messages, logs, and stack traces if applicable\n- Provide exact terminology, function names, API names, version numbers\n- Include relevant code snippets showing the problem or context\n- Specify platform, OS, framework versions, and environment details\n- Mention any attempted solutions or workarounds\n- Provide context about what you're trying to achieve\n\nThe more specific details you include, the more accurate and helpful the answer will be."
210210
},
211211
force_model: {
212212
type: "boolean",
@@ -225,7 +225,7 @@ class PerplexityServer {
225225
properties: {
226226
query: {
227227
type: "string",
228-
description: "The complex query or task to reason about"
228+
description: "The complex query or task to reason about. IMPORTANT: Be extremely specific and include all relevant details:\n- Include exact error messages, logs, and stack traces if applicable\n- Provide exact terminology, function names, API names, version numbers\n- Include relevant code snippets showing the problem or context\n- Specify platform, OS, framework versions, and environment details\n- Mention any attempted solutions or workarounds\n- Provide context about what you're trying to achieve\n- Include relevant data structures, configurations, or inputs\n\nThe more specific details you include, the more accurate and helpful the answer will be."
229229
},
230230
force_model: {
231231
type: "boolean",
@@ -244,7 +244,7 @@ class PerplexityServer {
244244
properties: {
245245
query: {
246246
type: "string",
247-
description: "The research topic or question to investigate in depth"
247+
description: "The research topic or question to investigate in depth. IMPORTANT: Be extremely specific and include all relevant details:\n- Include exact error messages, logs, and stack traces if applicable\n- Provide exact terminology, function names, API names, version numbers\n- Include relevant code snippets showing the problem or context\n- Specify platform, OS, framework versions, and environment details\n- Mention any attempted solutions or workarounds\n- Provide context about what you're trying to achieve\n- Include relevant data structures, configurations, or inputs\n- Specify the scope, constraints, or specific requirements\n\nThe more specific details you include, the more accurate and helpful the answer will be."
248248
},
249249
focus_areas: {
250250
type: "array",
@@ -289,42 +289,54 @@ class PerplexityServer {
289289
switch (selectedTool) {
290290
case "search": {
291291
model = "sonar-pro";
292-
prompt = `Provide a clear, concise answer to: ${query}`;
292+
prompt = `You are answering a query that should contain specific details like error messages, logs, code snippets, exact terminology, version numbers, and context. Use all provided details to give the most accurate answer possible.
293+
294+
Query: ${query}
295+
296+
Provide a clear, concise answer that directly addresses the specific details in the query.`;
293297
break;
294298
}
295299

296300
case "reason": {
297301
model = "sonar-reasoning-pro";
298-
prompt = `Provide a detailed explanation and analysis for: ${query}. Include:
299-
1. Step-by-step reasoning
300-
2. Key considerations
301-
3. Relevant examples
302-
4. Practical implications
303-
5. Potential alternatives`;
302+
prompt = `You are answering a query that should contain specific details like error messages, logs, code snippets, exact terminology, version numbers, and context. Carefully analyze all provided details to give the most accurate and helpful answer.
303+
304+
Query: ${query}
305+
306+
Provide a detailed explanation and analysis that:
307+
1. Addresses the specific details provided (errors, logs, code, versions, etc.)
308+
2. Includes step-by-step reasoning based on the actual context
309+
3. Identifies key considerations relevant to the specific situation
310+
4. Provides relevant examples matching the described scenario
311+
5. Offers practical implications based on the exact details provided
312+
6. Suggests potential alternatives or solutions tailored to the specific context`;
304313
break;
305314
}
306315

307316
case "deep_research": {
308317
model = "sonar-deep-research";
309318
const { focus_areas = [] } = request.params.arguments as { focus_areas?: string[] };
310319

311-
prompt = `Conduct comprehensive research on: ${query}`;
320+
prompt = `You are answering a research query that should contain specific details like error messages, logs, code snippets, exact terminology, version numbers, and context. Use all provided details to conduct the most accurate and comprehensive research.
321+
322+
Research Query: ${query}`;
312323

313324
if (focus_areas.length > 0) {
314325
prompt += `\n\nFocus areas:\n${focus_areas.map((area, i) => `${i + 1}. ${area}`).join('\n')}`;
315326
}
316327

317-
prompt += `\n\nProvide a detailed analysis including:
318-
1. Background and context
319-
2. Key concepts and definitions
320-
3. Current state of knowledge
321-
4. Different perspectives
322-
5. Recent developments
323-
6. Practical applications
324-
7. Challenges and limitations
325-
8. Future directions
326-
9. Expert opinions
327-
10. References to sources`;
328+
prompt += `\n\nProvide a detailed analysis that:
329+
1. Incorporates and addresses all specific details provided (errors, logs, code, versions, configurations, etc.)
330+
2. Provides background and context relevant to the specific scenario described
331+
3. Defines key concepts and terminology matching the exact terms used
332+
4. Presents the current state of knowledge relevant to the specific problem or topic
333+
5. Explores different perspectives applicable to the described situation
334+
6. Covers recent developments that relate to the specific details provided
335+
7. Discusses practical applications relevant to the exact context
336+
8. Identifies challenges and limitations specific to the scenario
337+
9. Suggests future directions or solutions based on the specific details
338+
10. Includes expert opinions and references to sources that address the specific issue
339+
11. Tailors all recommendations to the exact technical context, versions, and environment described`;
328340
break;
329341
}
330342

0 commit comments

Comments
 (0)