Skip to content

ollama_corpus_index

Index corpus. Build a persistent named corpus. Pass name + paths: string[]; the server chunks, embeds, stores the corpus at ~/.ollama-intern/corpora/.json AND writes a manifest at .manifest.json that captures the declared paths + chunk params + embed model. Idempotent — unchanged files are reused by sha256; changed files are re-embedded; paths not in the input are dropped. For day-to-day upkeep once a manifest exists, prefer ollama_corpus_refresh — it reconciles corpus vs manifest and reports drift.

Parameter Type Required Default Description
name string yes Corpus name (e.g. ‘memory’, ‘canon’, ‘handbook’). Maps to a file under ~/.ollama-intern/corpora/.
paths string[] yes Absolute file paths to include in the corpus. Pass an explicit list of files — corpus_index does NOT walk directories; you enumerate. Unchanged files are reused from the existing corpus by sha256.
chunk_chars integer no Chars per chunk (default 800).
chunk_overlap integer no Overlap between adjacent chunks (default 100).

The JSON Schema below is generated from the same zod schema the server validates against at the wire — it cannot drift from runtime behavior.

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 1,
"pattern": "^[a-zA-Z0-9_-]+$",
"description": "Corpus name (e.g. 'memory', 'canon', 'handbook'). Maps to a file under ~/.ollama-intern/corpora/."
},
"paths": {
"minItems": 1,
"type": "array",
"items": {
"type": "string",
"minLength": 1
},
"description": "Absolute file paths to include in the corpus. Pass an explicit list of files — corpus_index does NOT walk directories; you enumerate. Unchanged files are reused from the existing corpus by sha256."
},
"chunk_chars": {
"description": "Chars per chunk (default 800).",
"type": "integer",
"minimum": 100,
"maximum": 8000
},
"chunk_overlap": {
"description": "Overlap between adjacent chunks (default 100).",
"type": "integer",
"minimum": 0,
"maximum": 4000
}
},
"required": [
"name",
"paths"
]
}

Every tool returns the standard envelope — tier_used, model, tokens_in/tokens_out, elapsed_ms, backend provenance, warnings. See Envelope & tiers.

Schema + handler: src/tools/corpusIndex.ts · registration: src/index.ts


Back to the Tool Reference.