promptgraph-mcp 2.9.31 → 2.9.33
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/index.js +15 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -350,6 +350,8 @@ server.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
|
350
350
|
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
351
351
|
const { name, arguments: args } = request.params;
|
|
352
352
|
const fsSync = (await import('fs')).default;
|
|
353
|
+
// Ensure DB/model is ready (first call may come before watcher finishes init)
|
|
354
|
+
await new Promise(r => setTimeout(r, 50));
|
|
353
355
|
|
|
354
356
|
if (name === 'pg') {
|
|
355
357
|
const query = args?.query || '';
|
|
@@ -367,8 +369,19 @@ server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
|
367
369
|
let content = '';
|
|
368
370
|
try { content = fsSync.readFileSync(top.path, 'utf8'); } catch {}
|
|
369
371
|
const otherMatches = results.slice(1).map(r => `- **${r.name}** (${r.score?.toFixed(2)})`).join('\n');
|
|
370
|
-
const
|
|
371
|
-
return {
|
|
372
|
+
const otherMatchesNote = otherMatches ? `\n\n_Other matches: ${otherMatches}_` : '';
|
|
373
|
+
return {
|
|
374
|
+
messages: [
|
|
375
|
+
{
|
|
376
|
+
role: 'user',
|
|
377
|
+
content: { type: 'text', text: `Load skill: ${top.name}` },
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
role: 'assistant',
|
|
381
|
+
content: { type: 'text', text: `I've loaded the **${top.name}** skill (score: ${score.toFixed(2)}). Here are the instructions I'll follow:\n\n---\n\n${content}${otherMatchesNote}\n\n---\n\nSkill loaded. What would you like me to do?` },
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
};
|
|
372
385
|
}
|
|
373
386
|
|
|
374
387
|
// Low confidence — show top matches, let user pick
|