Local RAG (Retrieval-Augmented Generation) pipeline. Operations: ingest (chunk+embed+store file or text), search (retrieve relevant chunks by query), list_docs, delete_doc, clear. Uses local vector storage; no external service required.
ragretrievalembeddingsvectordocumentslocal
Input Parameters
Parameter
Type
Description
operationrequired
string
ingest: chunk+store document; search: retrieve relevant chunks; list_docs: list stored documents; delete_doc: remove a document; clear: clear all data. One of: ingest, search, list_docs, delete_doc, clear.
storagePathoptional
string
Directory for vector storage (default: ./rag_store).
filePathoptional
string
Path to file to ingest (for ingest operation).
textContentoptional
string
Text content to ingest directly (alternative to filePath).
docNameoptional
string
Document name/identifier for ingest.
queryoptional
string
Search query for retrieve operations.
topKoptional
integer
Number of top chunks to retrieve (default: 5). Default: 5.
chunkSizeoptional
integer
Characters per chunk for ingest (default: 500). Default: 500.
overlapoptional
integer
Character overlap between chunks (default: 50). Default: 50.
chunkIndexoptional
integer
Specific chunk index to retrieve.
minScoreoptional
string
Minimum similarity score (0.0–1.0) for search results.
Output Fields
Field
Type
Description
chunks
array[object]
docs
array[string]
count
integer
ok
boolean
error
string
Examples
Ingest text and search
// Input
{
"operation": "ingest",
"textContent": "PascalAI is a multi-agent AI platform built on Delphi.",
"docName": "intro"
}
// Output
{
"ok": true,
"count": 1
}
Install & Discovery
Install
ppm install mcp-rag
Get JSON Schema
GET /v1/packages/mcp-rag/1.0.0/schema
Discover by keyword
GET /v1/mcp/discover?q=rag
Discovery hint: Install with ppm install mcp-rag or invoke remotely via POST /v1/invoke/mcp-rag on the MCP Service.
PascalAI Usage
uses toolslib;
var Tool := LoadTool('mcp-rag');
var R := Tool.Call(JsonObj(['operation','search','query','What is PascalAI?','topK',3]));
Writeln(R.ToJSON);