MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / index_repository

Function index_repository

src/codegraphcontext/api/router.py:93–120  ·  view source on GitHub ↗
(
    request: IndexRequest,
    background_tasks: BackgroundTasks,
    server: MCPServer = Depends(get_server)
)

Source from the content-addressed store, hash-verified

91
92@router.post("/index", response_model=ApiResponse)
93async def index_repository(
94 request: IndexRequest,
95 background_tasks: BackgroundTasks,
96 server: MCPServer = Depends(get_server)
97):
98 # The add_code_to_graph handler only understands "path" (and is_dependency);
99 # repo_name/branch/force from the request model are not supported by it.
100 args = {"path": request.path}
101
102 try:
103 result = await server.handle_tool_call(
104 "add_code_to_graph",
105 args
106 )
107 except (OSError, socket.error) as exc:
108 raise_service_unavailable(exc)
109
110 if "error" in result:
111 raise HTTPException(
112 status_code=400,
113 detail=result["error"]
114 )
115
116 return ApiResponse(
117 status="ok",
118 message="Indexing job started",
119 data=result
120 )
121
122@router.post("/query", response_model=ApiResponse)
123async def execute_query(

Callers

nothing calls this directly

Calls 3

ApiResponseClass · 0.85
handle_tool_callMethod · 0.45

Tested by

no test coverage detected