Skip to content

Commit 429a7ba

Browse files
committed
fix: reject empty include_paths instead of silently indexing full repo
[] is falsy in Python, so 'if include_paths:' treated an explicit empty list the same as None (omitted). Now returns a clear error for empty list, preserving the distinction between 'index everything' (omit include_paths) and 'index nothing' (empty list).
1 parent 2e48561 commit 429a7ba

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

mcp-server/handlers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ async def _handle_index_repository(args: dict[str, Any]) -> str:
131131
repo_id = args["repo_id"]
132132
include_paths = args.get("include_paths")
133133

134+
if include_paths is not None and len(include_paths) == 0:
135+
return "Error: include_paths cannot be empty. Omit it to index the full repo, or provide directory names."
136+
134137
if include_paths:
135138
# Async endpoint supports include_paths for monorepo subset indexing
136139
result = await api_post(

0 commit comments

Comments
 (0)