Skip to content

MCP Tools Reference

LocalLens exposes 5 tools via the MCP protocol.

Search indexed files by semantic meaning, keywords, or hybrid. Supports query arithmetic: use + to add concepts and - to subtract. Example: "pricing strategy -draft +recent".

Parameters:

NameTypeDefaultDescription
querystring(required)Search query (supports +/- operators for query arithmetic)
top_kinteger5Max results
file_typestring | nullnullFilter by extension
modestring"hybrid""semantic", "keyword", or "hybrid"

Response:

json
[
  {
    "file_path": "/Users/me/project/auth.py",
    "file_name": "auth.py",
    "file_type": ".py",
    "chunk_text": "def authenticate_user(username, password)...",
    "chunk_index": 2,
    "score": 0.8742,
    "extractor": "code"
  }
]

locallens_ask

Ask a question and get an answer with source citations. Requires Ollama.

Parameters:

NameTypeDefaultDescription
questionstring(required)Question to ask
top_kinteger3Context chunks

Response:

json
{
  "answer": "The authentication module uses bcrypt for password hashing...",
  "sources": [
    {
      "file_path": "/Users/me/project/auth.py",
      "file_name": "auth.py",
      "file_type": ".py",
      "chunk_text": "...",
      "chunk_index": 2,
      "score": 0.8742,
      "extractor": "code"
    }
  ],
  "model": "qwen2.5:3b",
  "duration_seconds": 4.12
}

locallens_index

Index a folder of files for semantic search.

Parameters:

NameTypeDefaultDescription
folder_pathstring(required)Folder to index
forcebooleanfalseRe-index all files

Response:

json
{
  "total_files": 15,
  "new_files": 3,
  "updated_files": 0,
  "skipped_files": 12,
  "total_chunks": 487,
  "duration_seconds": 2.1
}

locallens_status

Get current status including indexed file count and health checks.

Parameters: None.

Response:

json
{
  "stats": {
    "total_files": 42,
    "total_chunks": 1284,
    "file_types": { ".py": 320, ".md": 280 },
    "collection_name": "locallens",
    "data_dir": "/Users/me/.locallens"
  },
  "health": [
    { "name": "Qdrant Edge", "status": "ok", "message": "1284 points in shard" },
    { "name": "Ollama", "status": "ok", "message": "Running at http://localhost:11434" }
  ]
}

locallens_files

List all indexed files.

Parameters:

NameTypeDefaultDescription
file_typestring | nullnullFilter by extension

Response:

json
[
  {
    "file_path": "/Users/me/project/main.py",
    "file_name": "main.py",
    "file_type": ".py",
    "chunk_count": 8,
    "indexed_at": "2024-12-15T10:30:00Z"
  }
]

Released under the MIT License.