@mhalder/qdrant-mcp-server 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +68 -0
- package/build/index.js +581 -517
- package/build/index.js.map +1 -1
- package/build/prompts/index.d.ts +7 -0
- package/build/prompts/index.d.ts.map +1 -0
- package/build/prompts/index.js +7 -0
- package/build/prompts/index.js.map +1 -0
- package/build/prompts/index.test.d.ts +2 -0
- package/build/prompts/index.test.d.ts.map +1 -0
- package/build/prompts/index.test.js +25 -0
- package/build/prompts/index.test.js.map +1 -0
- package/build/prompts/loader.d.ts +25 -0
- package/build/prompts/loader.d.ts.map +1 -0
- package/build/prompts/loader.js +81 -0
- package/build/prompts/loader.js.map +1 -0
- package/build/prompts/loader.test.d.ts +2 -0
- package/build/prompts/loader.test.d.ts.map +1 -0
- package/build/prompts/loader.test.js +417 -0
- package/build/prompts/loader.test.js.map +1 -0
- package/build/prompts/template.d.ts +20 -0
- package/build/prompts/template.d.ts.map +1 -0
- package/build/prompts/template.js +52 -0
- package/build/prompts/template.js.map +1 -0
- package/build/prompts/template.test.d.ts +2 -0
- package/build/prompts/template.test.d.ts.map +1 -0
- package/build/prompts/template.test.js +163 -0
- package/build/prompts/template.test.js.map +1 -0
- package/build/prompts/types.d.ts +34 -0
- package/build/prompts/types.d.ts.map +1 -0
- package/build/prompts/types.js +5 -0
- package/build/prompts/types.js.map +1 -0
- package/package.json +1 -1
- package/prompts.example.json +96 -0
- package/src/index.ts +639 -547
- package/src/prompts/index.test.ts +29 -0
- package/src/prompts/index.ts +7 -0
- package/src/prompts/loader.test.ts +494 -0
- package/src/prompts/loader.ts +90 -0
- package/src/prompts/template.test.ts +212 -0
- package/src/prompts/template.ts +69 -0
- package/src/prompts/types.ts +37 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { renderTemplate, validateArguments } from "./template.js";
|
|
3
|
+
describe("renderTemplate", () => {
|
|
4
|
+
it("should render template with provided arguments", () => {
|
|
5
|
+
const template = "Search {{collection}} for {{query}}";
|
|
6
|
+
const args = { collection: "papers", query: "machine learning" };
|
|
7
|
+
const result = renderTemplate(template, args);
|
|
8
|
+
expect(result.text).toBe("Search papers for machine learning");
|
|
9
|
+
});
|
|
10
|
+
it("should handle multiple occurrences of the same variable", () => {
|
|
11
|
+
const template = "{{name}} said hello. {{name}} said goodbye.";
|
|
12
|
+
const args = { name: "Alice" };
|
|
13
|
+
const result = renderTemplate(template, args);
|
|
14
|
+
expect(result.text).toBe("Alice said hello. Alice said goodbye.");
|
|
15
|
+
});
|
|
16
|
+
it("should use default values for missing arguments", () => {
|
|
17
|
+
const template = "Return {{limit}} results";
|
|
18
|
+
const args = {};
|
|
19
|
+
const definitions = [
|
|
20
|
+
{ name: "limit", description: "Number of results", required: false, default: "5" },
|
|
21
|
+
];
|
|
22
|
+
const result = renderTemplate(template, args, definitions);
|
|
23
|
+
expect(result.text).toBe("Return 5 results");
|
|
24
|
+
});
|
|
25
|
+
it("should prefer provided arguments over defaults", () => {
|
|
26
|
+
const template = "Return {{limit}} results";
|
|
27
|
+
const args = { limit: "10" };
|
|
28
|
+
const definitions = [
|
|
29
|
+
{ name: "limit", description: "Number of results", required: false, default: "5" },
|
|
30
|
+
];
|
|
31
|
+
const result = renderTemplate(template, args, definitions);
|
|
32
|
+
expect(result.text).toBe("Return 10 results");
|
|
33
|
+
});
|
|
34
|
+
it("should keep placeholder if no value and no default", () => {
|
|
35
|
+
const template = "Search {{collection}} for {{query}}";
|
|
36
|
+
const args = { collection: "papers" };
|
|
37
|
+
const result = renderTemplate(template, args);
|
|
38
|
+
expect(result.text).toBe("Search papers for {{query}}");
|
|
39
|
+
});
|
|
40
|
+
it("should handle templates with no placeholders", () => {
|
|
41
|
+
const template = "This is a plain text template";
|
|
42
|
+
const args = { foo: "bar" };
|
|
43
|
+
const result = renderTemplate(template, args);
|
|
44
|
+
expect(result.text).toBe("This is a plain text template");
|
|
45
|
+
});
|
|
46
|
+
it("should handle empty template", () => {
|
|
47
|
+
const template = "";
|
|
48
|
+
const args = { foo: "bar" };
|
|
49
|
+
const result = renderTemplate(template, args);
|
|
50
|
+
expect(result.text).toBe("");
|
|
51
|
+
});
|
|
52
|
+
it("should handle empty args", () => {
|
|
53
|
+
const template = "Search {{collection}}";
|
|
54
|
+
const result = renderTemplate(template);
|
|
55
|
+
expect(result.text).toBe("Search {{collection}}");
|
|
56
|
+
});
|
|
57
|
+
it("should handle complex template with multiple variables and defaults", () => {
|
|
58
|
+
const template = "Search the '{{collection}}' collection for documents similar to: '{{query}}'. Return the top {{limit}} most relevant results.";
|
|
59
|
+
const args = { collection: "papers", query: "neural networks" };
|
|
60
|
+
const definitions = [
|
|
61
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
62
|
+
{ name: "query", description: "Search query", required: true },
|
|
63
|
+
{ name: "limit", description: "Number of results", required: false, default: "5" },
|
|
64
|
+
];
|
|
65
|
+
const result = renderTemplate(template, args, definitions);
|
|
66
|
+
expect(result.text).toBe("Search the 'papers' collection for documents similar to: 'neural networks'. Return the top 5 most relevant results.");
|
|
67
|
+
});
|
|
68
|
+
it("should handle special characters in argument values", () => {
|
|
69
|
+
const template = "Query: {{query}}";
|
|
70
|
+
const args = { query: "What is $100 + $200?" };
|
|
71
|
+
const result = renderTemplate(template, args);
|
|
72
|
+
expect(result.text).toBe("Query: What is $100 + $200?");
|
|
73
|
+
});
|
|
74
|
+
it("should handle numeric-like values as strings", () => {
|
|
75
|
+
const template = "ID: {{id}}, Count: {{count}}";
|
|
76
|
+
const args = { id: "123", count: "456" };
|
|
77
|
+
const result = renderTemplate(template, args);
|
|
78
|
+
expect(result.text).toBe("ID: 123, Count: 456");
|
|
79
|
+
});
|
|
80
|
+
it("should handle whitespace in variable names", () => {
|
|
81
|
+
const template = "Value: {{key}}";
|
|
82
|
+
const args = { key: " spaced " };
|
|
83
|
+
const result = renderTemplate(template, args);
|
|
84
|
+
expect(result.text).toBe("Value: spaced ");
|
|
85
|
+
});
|
|
86
|
+
it("should not match invalid placeholder patterns", () => {
|
|
87
|
+
const template = "{{ invalid }} {missing} {{also invalid}} {{valid}}";
|
|
88
|
+
const args = { valid: "yes" };
|
|
89
|
+
const result = renderTemplate(template, args);
|
|
90
|
+
// Only {{valid}} should be replaced, others don't match \w+ pattern
|
|
91
|
+
expect(result.text).toBe("{{ invalid }} {missing} {{also invalid}} yes");
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
describe("validateArguments", () => {
|
|
95
|
+
it("should pass validation when all required arguments are provided", () => {
|
|
96
|
+
const args = { collection: "papers", query: "test" };
|
|
97
|
+
const definitions = [
|
|
98
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
99
|
+
{ name: "query", description: "Search query", required: true },
|
|
100
|
+
];
|
|
101
|
+
expect(() => validateArguments(args, definitions)).not.toThrow();
|
|
102
|
+
});
|
|
103
|
+
it("should throw error when required argument is missing", () => {
|
|
104
|
+
const args = { collection: "papers" };
|
|
105
|
+
const definitions = [
|
|
106
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
107
|
+
{ name: "query", description: "Search query", required: true },
|
|
108
|
+
];
|
|
109
|
+
expect(() => validateArguments(args, definitions)).toThrow("Missing required arguments: query");
|
|
110
|
+
});
|
|
111
|
+
it("should throw error when required argument is empty string", () => {
|
|
112
|
+
const args = { collection: "papers", query: "" };
|
|
113
|
+
const definitions = [
|
|
114
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
115
|
+
{ name: "query", description: "Search query", required: true },
|
|
116
|
+
];
|
|
117
|
+
expect(() => validateArguments(args, definitions)).toThrow("Missing required arguments: query");
|
|
118
|
+
});
|
|
119
|
+
it("should throw error listing multiple missing arguments", () => {
|
|
120
|
+
const args = {};
|
|
121
|
+
const definitions = [
|
|
122
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
123
|
+
{ name: "query", description: "Search query", required: true },
|
|
124
|
+
{ name: "filter", description: "Filter", required: true },
|
|
125
|
+
];
|
|
126
|
+
expect(() => validateArguments(args, definitions)).toThrow("Missing required arguments: collection, query, filter");
|
|
127
|
+
});
|
|
128
|
+
it("should not throw for missing optional arguments", () => {
|
|
129
|
+
const args = { collection: "papers", query: "test" };
|
|
130
|
+
const definitions = [
|
|
131
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
132
|
+
{ name: "query", description: "Search query", required: true },
|
|
133
|
+
{ name: "limit", description: "Limit", required: false, default: "5" },
|
|
134
|
+
];
|
|
135
|
+
expect(() => validateArguments(args, definitions)).not.toThrow();
|
|
136
|
+
});
|
|
137
|
+
it("should pass validation with empty definitions", () => {
|
|
138
|
+
const args = { foo: "bar" };
|
|
139
|
+
const definitions = [];
|
|
140
|
+
expect(() => validateArguments(args, definitions)).not.toThrow();
|
|
141
|
+
});
|
|
142
|
+
it("should pass validation with no definitions", () => {
|
|
143
|
+
const args = { foo: "bar" };
|
|
144
|
+
expect(() => validateArguments(args, [])).not.toThrow();
|
|
145
|
+
});
|
|
146
|
+
it("should not require arguments that are not defined", () => {
|
|
147
|
+
const args = { collection: "papers", extra: "data" };
|
|
148
|
+
const definitions = [
|
|
149
|
+
{ name: "collection", description: "Collection name", required: true },
|
|
150
|
+
];
|
|
151
|
+
expect(() => validateArguments(args, definitions)).not.toThrow();
|
|
152
|
+
});
|
|
153
|
+
it("should handle mixed required and optional arguments", () => {
|
|
154
|
+
const args = { name: "test" };
|
|
155
|
+
const definitions = [
|
|
156
|
+
{ name: "name", description: "Name", required: true },
|
|
157
|
+
{ name: "limit", description: "Limit", required: false },
|
|
158
|
+
{ name: "filter", description: "Filter", required: false },
|
|
159
|
+
];
|
|
160
|
+
expect(() => validateArguments(args, definitions)).not.toThrow();
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
//# sourceMappingURL=template.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.test.js","sourceRoot":"","sources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,IAAI,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAC9B,MAAM,WAAW,GAAqB;YACpC,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;YACrD,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;YACxD,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE;SAC3D,CAAC;QAEF,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACnE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration types for MCP prompts
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Argument definition for a prompt
|
|
6
|
+
*/
|
|
7
|
+
export interface PromptArgument {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
required: boolean;
|
|
11
|
+
default?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Individual prompt definition
|
|
15
|
+
*/
|
|
16
|
+
export interface PromptDefinition {
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
arguments: PromptArgument[];
|
|
20
|
+
template: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Root configuration structure
|
|
24
|
+
*/
|
|
25
|
+
export interface PromptsConfig {
|
|
26
|
+
prompts: PromptDefinition[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parsed template with resolved arguments
|
|
30
|
+
*/
|
|
31
|
+
export interface RenderedPrompt {
|
|
32
|
+
text: string;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,gBAAgB,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"prompts": [
|
|
3
|
+
{
|
|
4
|
+
"name": "setup_rag_collection",
|
|
5
|
+
"description": "Create a new collection optimized for RAG workflows with hybrid search",
|
|
6
|
+
"arguments": [
|
|
7
|
+
{
|
|
8
|
+
"name": "name",
|
|
9
|
+
"description": "Name for the new collection",
|
|
10
|
+
"required": true
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"template": "Create a new Qdrant collection named '{{name}}' optimized for RAG (Retrieval-Augmented Generation) workflows:\n\n1. Create the collection with hybrid search enabled (enableHybrid: true) to combine semantic and keyword search for better retrieval accuracy\n2. Use Cosine distance metric (optimal for most embedding models)\n3. After creation, show the collection info and explain the configuration\n4. Provide guidance on adding documents with proper metadata structure for RAG use cases"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"name": "analyze_and_optimize",
|
|
17
|
+
"description": "Analyze a collection and provide optimization recommendations",
|
|
18
|
+
"arguments": [
|
|
19
|
+
{
|
|
20
|
+
"name": "collection",
|
|
21
|
+
"description": "Name of the collection to analyze",
|
|
22
|
+
"required": true
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"template": "Perform a comprehensive analysis of the '{{collection}}' collection:\n\n1. Get the collection info (dimensions, document count, distance metric, hybrid search status)\n2. Analyze the configuration and provide insights:\n - Is the distance metric appropriate for the use case?\n - Should hybrid search be enabled for better results?\n - Is the document count sufficient for meaningful similarity search?\n3. Provide specific, actionable optimization recommendations\n4. If the collection seems suboptimal, suggest a migration strategy"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "compare_search_strategies",
|
|
29
|
+
"description": "Compare semantic vs hybrid search to determine best approach",
|
|
30
|
+
"arguments": [
|
|
31
|
+
{
|
|
32
|
+
"name": "collection",
|
|
33
|
+
"description": "Collection name (must have hybrid search enabled)",
|
|
34
|
+
"required": true
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "query",
|
|
38
|
+
"description": "Test query",
|
|
39
|
+
"required": true
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"template": "Compare search strategies for '{{query}}' in the '{{collection}}' collection:\n\n1. Perform semantic_search and show top 5 results with scores\n2. Perform hybrid_search and show top 5 results with scores\n3. Analyze the differences:\n - Which results appear in both? Which are unique to each method?\n - How do the relevance scores compare?\n - Which method seems more accurate for this query type?\n4. Recommend which search strategy to use based on:\n - Query characteristics (keyword-heavy vs conceptual)\n - Result quality and relevance\n - Use case requirements"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "migrate_to_hybrid",
|
|
46
|
+
"description": "Migrate an existing collection to use hybrid search",
|
|
47
|
+
"arguments": [
|
|
48
|
+
{
|
|
49
|
+
"name": "source",
|
|
50
|
+
"description": "Name of the existing collection to migrate",
|
|
51
|
+
"required": true
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "target",
|
|
55
|
+
"description": "Name for the new hybrid-enabled collection",
|
|
56
|
+
"required": true
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"template": "Migrate the '{{source}}' collection to a new hybrid search-enabled collection '{{target}}':\n\n1. First, analyze the source collection to understand its current configuration\n2. Create the target collection with hybrid search enabled, matching the source's distance metric\n3. Guide the user through retrieving documents from the source (note: you'll need to implement a retrieval mechanism or have the user provide the documents)\n4. Explain how to add the documents to the new hybrid collection\n5. Provide verification steps to ensure the migration was successful\n6. Ask if the user wants to delete the old collection after verification"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "debug_search_quality",
|
|
63
|
+
"description": "Debug poor search results and suggest improvements",
|
|
64
|
+
"arguments": [
|
|
65
|
+
{
|
|
66
|
+
"name": "collection",
|
|
67
|
+
"description": "Collection with poor search quality",
|
|
68
|
+
"required": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "problematic_query",
|
|
72
|
+
"description": "A query that returns poor results",
|
|
73
|
+
"required": true
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"template": "Debug search quality issues in '{{collection}}' for query '{{problematic_query}}':\n\n1. Get collection info to understand the configuration\n2. Perform a search with the problematic query and analyze the results:\n - Are the scores too low (< 0.5)? This suggests poor embedding quality or mismatched query/document domains\n - Are irrelevant results ranking highly? This suggests metadata or hybrid search could help\n3. Test if hybrid search is available and compare results\n4. Provide specific recommendations:\n - Should documents be re-embedded with a different model?\n - Would metadata filtering help narrow results?\n - Is the collection too small or missing relevant documents?\n - Should the distance metric be changed?\n5. Suggest concrete next steps to improve search quality"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "build_knowledge_base",
|
|
80
|
+
"description": "Guide for building a structured knowledge base with metadata",
|
|
81
|
+
"arguments": [
|
|
82
|
+
{
|
|
83
|
+
"name": "collection",
|
|
84
|
+
"description": "Collection name for the knowledge base",
|
|
85
|
+
"required": true
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "domain",
|
|
89
|
+
"description": "Domain or topic of the knowledge base",
|
|
90
|
+
"required": true
|
|
91
|
+
}
|
|
92
|
+
],
|
|
93
|
+
"template": "Build a structured knowledge base in '{{collection}}' for the {{domain}} domain:\n\n1. Create (or verify) the collection with hybrid search enabled for optimal retrieval\n2. Design a metadata schema appropriate for {{domain}}, such as:\n - category/topic fields for filtering\n - timestamps for temporal filtering\n - source/author for provenance\n - confidence/quality scores\n3. Provide guidance on document structure:\n - Optimal chunk sizes (typically 200-500 tokens)\n - How to maintain context across chunks\n - Metadata to include with each document\n4. Show example documents with proper formatting\n5. Explain search strategies for this knowledge base:\n - When to use metadata filters\n - When hybrid search adds value\n - How to handle multi-step queries"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|