Add AI prompt tool for natural language graph operations
New MCP tool and portal UI for executing natural language instructions against the memory graph via Ollama (qwen3-coder:30b). Single LLM call generates a JSON action plan which is executed sequentially. Supports 8 action types: add_node, update_node, remove_node, add_edge, remove_edge, bulk_tag, reorganize, query. Actions can reference previous results via $result[N].field interpolation. Uses /api/chat with few-shot assistant example, format:json, and temperature:0 for reliable output.
This commit is contained in:
@@ -166,4 +166,19 @@ router.post('/maintenance/run', async (_req: Request, res: Response) => {
|
||||
}
|
||||
});
|
||||
|
||||
// Prompt — AI-driven natural language instruction
|
||||
router.post('/prompt', async (req: Request, res: Response) => {
|
||||
try {
|
||||
const { prompt } = req.body;
|
||||
if (!prompt || typeof prompt !== 'string') {
|
||||
return res.status(400).json({ error: 'prompt is required' });
|
||||
}
|
||||
const { interpretAndExecute } = await import('../core/prompt/interpreter');
|
||||
const result = await interpretAndExecute(prompt);
|
||||
res.json(result);
|
||||
} catch (err: any) {
|
||||
res.status(500).json({ error: err.message });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
Reference in New Issue
Block a user