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

Function index_repository

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

ApiResponseClass · 0.85
handle_tool_callMethod · 0.45

Tested by

no test coverage detected