(
request: IndexRequest,
background_tasks: BackgroundTasks,
server: MCPServer = Depends(get_server)
)
| 91 | |
| 92 | @router.post("/index", response_model=ApiResponse) |
| 93 | async 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) |
| 123 | async def execute_query( |
nothing calls this directly
no test coverage detected