[Embedding] numpy not available, using pure Python vectors
[Embedding] Loaded 100 cached embeddings
[Embedding] Using Gradio API: https://iotacluster-embedding-model.hf.space/gradio_api/call/embed_dense
[Embedding] Dimension: 768
======================================================================
   E2E TEST: ALL MCP TOOLS (via CodingAPI)
======================================================================
API initialized at: /Users/gargdhruv/Desktop/manhattan-pip/manhattan-mcp/.test_e2e_data
Sample file: /Users/gargdhruv/Desktop/manhattan-pip/manhattan-mcp/src/manhattan_mcp/server.py

  [PASS] api_usage
[Embedding] Batch embedding 15 texts with 10 workers...
  [PASS] index_file
  [PASS] get_file_outline
  [PASS] read_file_context
  [FAIL] search_codebase
         {'status': 'search_results', 'query': 'MCP tool definitions', 'filter': None, 'results': [{'file_path': '/Users/gargdhruv/Desktop/manhattan-pip/manhattan-mcp/src/manhattan_mcp/server.py', 'chunk': {'content': 'from mcp.server.fastmcp import FastMCP', 'type': 'import', 'name': 'imports', 'start_line': 19, 'end_line': 19, 'language': 'python', 'token_count': 9, 'keywords': ['fastmcp', 'import', 'imports', 'code'], 'summary': 'Code unit: imports'}, 'score': 0.409229, 'match_type': 'hybrid', 'vector_score': 0.510985, 'keyword_score': 0.28486}, {'file_path': '/Users/gargdhruv/Desktop/manhattan-pip/manhattan-mcp/src/manhattan_mcp/server.py', 'chunk': {'content': 'mcp = FastMCP(\n    "manhattan_local",\n    instructions="""\n⚡ MANDATORY: TOKEN-EFFICIENT CODEBASE NAVIGATION SYSTEM ⚡\n\nYou have a VIRTUAL FILE SYSTEM that caches and compresses code context.\nALWAYS use these tools instead of your built-in equivalents:\n\n╔══════════════════════════════════════════════════════════════╗\n║  INSTEAD OF          →  USE THIS (saves 50-80% tokens)      ║\n╠══════════════════════════════════════════════════════════════╣\n║  view_file           →  read_file_context(file_path)        ║\n║  list_dir            →  list_directory(path)                ║\n║  view_file_outline   →  get_file_outline(file_path)         ║\n║  grep_search         →  search_codebase(query)              ║\n╚══════════════════════════════════════════════════════════════╝\n\nAFTER modifying files → call index_file(file_path) to update the cache.\nCHECK savings         → call get_token_savings() to see cumulative savings.\n\nWHY: Every raw file read costs thousands of tokens. This system\ncompresses files to ~30% while preserving all semantic meaning\n(function signatures, class structures, logic summaries).\n\nWORKFLOW:\n1. Use read_file_context() to read files — returns compressed cached context\n2. Use search_codebase() to find code — semantic search across ALL indexed files\n3. Use get_file_outline() for quick structure overview — ~10% of file tokens\n4. Use index_file() after modifying files to keep cache fresh\n"""\n)', 'type': 'assignment', 'name': 'constant', 'start_line': 33, 'end_line': 63, 'language': 'python', 'token_count': 353, 'keywords': ['constant', 'assignment', 'code'], 'summary': 'Code unit: constant'}, 'score': 0.329332, 'match_type': 'hybrid', 'vector_score': 0.365719, 'keyword_score': 0.28486}, {'file_path': '/Users/gargdhruv/Desktop/manhattan-pip/manhattan-mcp/src/manhattan_mcp/server.py', 'chunk': {'content': 'def get_data_dir() -> Path:\n    """\n    Get the OS-specific data directory for the application.\n    """\n    # Check for environment variable override\n    env_path = os.environ.get("MANHATTAN_MEM_PATH") or os.environ.get("MANHATTAN_COLLAB_PATH")\n    if env_path:\n        return Path(env_path)\n\n    app_name = "manhattan-mcp"\n    system = platform.system()\n\n    if system == "Windows":\n        base_path = os.environ.get("LOCALAPPDATA")\n        if not base_path:\n            base_path = os.path.expanduser("~\\\\AppData\\\\Local")\n        return Path(base_path) / app_name / "data"\n    \n    elif system == "Darwin":  # macOS\n        return Path.home() / "Library" / "Application Support" / app_name / "data"\n    \n    else:  # Linux and others\n        # XDG Base Directory Specification\n        xdg_data_home = os.environ.get("XDG_DATA_HOME")\n        if xdg_data_home:\n            return Path(xdg_data_home) / app_name / "data"\n        return Path.home() / ".local" / "share" / app_name / "data"', 'type': 'function', 'name': 'get_data_dir', 'start_line': 67, 'end_line': 93, 'language': 'python', 'token_count': 247, 'keywords': ['environ', 'get_data_dir', 'expanduser', 'path', 'data', 'platform', 'get', 'function', 'home', 'dir', 'system', 'code'], 'summary': 'Code unit: get_data_dir'}, 'score': 0.249618, 'match_type': 'hybrid', 'vector_score': 0.220784, 'keyword_score': 0.28486}], 'count': 3}
  [PASS] list_directory
  [PASS] reindex_file
  [PASS] list_indexed_files
  [PASS] remove_index
  [PASS] get_token_savings

======================================================================
   RESULTS: 9 passed, 1 failed
======================================================================

