MCPcopy
hub / github.com/HKUDS/DeepCode / get_indexes_overview

Function get_indexes_overview

tools/code_reference_indexer.py:412–476  ·  view source on GitHub ↗

Get overview of all available reference code index information from specified directory Args: indexes_path: Path to the indexes directory containing JSON index files Returns: Overview information of all available reference code JSON string

(indexes_path: str)

Source from the content-addressed store, hash-verified

410
411@mcp.tool()
412async def get_indexes_overview(indexes_path: str) -> str:
413 """
414 Get overview of all available reference code index information from specified directory
415
416 Args:
417 indexes_path: Path to the indexes directory containing JSON index files
418
419 Returns:
420 Overview information of all available reference code JSON string
421 """
422 try:
423 # Load index files from specified directory
424 index_cache = load_index_files_from_directory(indexes_path)
425
426 if not index_cache:
427 result = {
428 "status": "error",
429 "message": f"No index files found in: {indexes_path}",
430 "indexes_path": indexes_path,
431 }
432 return json.dumps(result, ensure_ascii=False, indent=2)
433
434 overview = {"total_repos": len(index_cache), "repositories": {}}
435
436 for repo_name, index_data in index_cache.items():
437 repo_info = {
438 "repo_name": index_data.get("repo_name", repo_name),
439 "total_files": index_data.get("total_files", 0),
440 "file_types": [],
441 "main_concepts": [],
442 "total_relationships": len(index_data.get("relationships", [])),
443 }
444
445 # Collect file types and concepts
446 file_summaries = index_data.get("file_summaries", [])
447 file_types = set()
448 concepts = set()
449
450 for file_summary in file_summaries:
451 file_types.add(file_summary.get("file_type", "Unknown"))
452 concepts.update(file_summary.get("key_concepts", []))
453
454 repo_info["file_types"] = sorted(list(file_types))
455 repo_info["main_concepts"] = sorted(list(concepts))[
456 :20
457 ] # Limit concept count
458
459 overview["repositories"][repo_name] = repo_info
460
461 result = {
462 "status": "success",
463 "overview": overview,
464 "indexes_directory": str(Path(indexes_path).resolve()),
465 "total_indexes_loaded": len(index_cache),
466 }
467
468 return json.dumps(result, ensure_ascii=False, indent=2)
469

Callers

nothing calls this directly

Calls 2

getMethod · 0.80

Tested by

no test coverage detected