Skip to content

Commit 70deab2

Browse files
committed
Add default collection
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
1 parent b33e9f1 commit 70deab2

2 files changed

Lines changed: 235 additions & 45 deletions

File tree

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,9 +535,14 @@ A knowledge base management server that provides tools to interact with [LocalRe
535535
**Configuration:**
536536
- `LOCALRECALL_URL` - Base URL for LocalRecall API (default: `http://localhost:8080`)
537537
- `LOCALRECALL_API_KEY` - Optional API key for authentication (sent as `Authorization: Bearer <key>`)
538+
- `LOCALRECALL_COLLECTION` - Default collection name (if set, tools are registered without `collection_name` parameter - the collection is automatically used from the environment variable)
538539
- `LOCALRECALL_ENABLED_TOOLS` - Comma-separated list of tools to enable (default: all tools enabled). Valid values: `search`, `create_collection`, `reset_collection`, `add_document`, `list_collections`, `list_files`, `delete_entry`
539540

541+
**Note:** When `LOCALRECALL_COLLECTION` is set, the tools `search`, `add_document`, `list_files`, and `delete_entry` are registered with different input schemas that do not include the `collection_name` parameter. The collection name is automatically taken from the environment variable.
542+
540543
**Search Input Format:**
544+
545+
When `LOCALRECALL_COLLECTION` is **not** set:
541546
```json
542547
{
543548
"collection_name": "myCollection",
@@ -546,6 +551,14 @@ A knowledge base management server that provides tools to interact with [LocalRe
546551
}
547552
```
548553

554+
When `LOCALRECALL_COLLECTION` is set (e.g., `LOCALRECALL_COLLECTION=myCollection`), the tool schema does not include `collection_name`:
555+
```json
556+
{
557+
"query": "search term",
558+
"max_results": 5
559+
}
560+
```
561+
549562
**Search Output Format:**
550563
```json
551564
{
@@ -562,6 +575,8 @@ A knowledge base management server that provides tools to interact with [LocalRe
562575
```
563576

564577
**Add Document Input Format:**
578+
579+
When `LOCALRECALL_COLLECTION` is **not** set:
565580
```json
566581
{
567582
"collection_name": "myCollection",
@@ -579,11 +594,57 @@ Or with inline content:
579594
}
580595
```
581596

597+
When `LOCALRECALL_COLLECTION` is set, the tool schema does not include `collection_name`:
598+
```json
599+
{
600+
"file_path": "/path/to/file.txt",
601+
"filename": "file.txt"
602+
}
603+
```
604+
605+
**List Files Input Format:**
606+
607+
When `LOCALRECALL_COLLECTION` is **not** set:
608+
```json
609+
{
610+
"collection_name": "myCollection"
611+
}
612+
```
613+
614+
When `LOCALRECALL_COLLECTION` is set, the tool schema has no parameters (empty object):
615+
```json
616+
{}
617+
```
618+
619+
**Delete Entry Input Format:**
620+
621+
When `LOCALRECALL_COLLECTION` is **not** set:
622+
```json
623+
{
624+
"collection_name": "myCollection",
625+
"entry": "filename.txt"
626+
}
627+
```
628+
629+
When `LOCALRECALL_COLLECTION` is set, the tool schema does not include `collection_name`:
630+
```json
631+
{
632+
"entry": "filename.txt"
633+
}
634+
```
635+
582636
**Docker Image:**
583637
```bash
584638
docker run -e LOCALRECALL_URL=http://localhost:8080 -e LOCALRECALL_API_KEY=your-key-here ghcr.io/mudler/mcps/localrecall:latest
585639
```
586640

641+
**With default collection (tools will not require `collection_name` parameter):**
642+
```bash
643+
docker run -e LOCALRECALL_URL=http://localhost:8080 -e LOCALRECALL_COLLECTION=myCollection ghcr.io/mudler/mcps/localrecall:latest
644+
```
645+
646+
When `LOCALRECALL_COLLECTION` is set, the collection-specific tools (`search`, `add_document`, `list_files`, `delete_entry`) are automatically configured to use that collection, and the `collection_name` parameter is removed from their input schemas.
647+
587648
**Enable specific tools only:**
588649
```bash
589650
docker run -e LOCALRECALL_URL=http://localhost:8080 -e LOCALRECALL_ENABLED_TOOLS="search,list_collections,list_files" ghcr.io/mudler/mcps/localrecall:latest
@@ -600,6 +661,7 @@ mcp:
600661
"env": {
601662
"LOCALRECALL_URL": "http://localhost:8080",
602663
"LOCALRECALL_API_KEY": "your-api-key",
664+
"LOCALRECALL_COLLECTION": "myCollection",
603665
"LOCALRECALL_ENABLED_TOOLS": "search,list_collections,add_document"
604666
},
605667
"args": [

0 commit comments

Comments
 (0)