@@ -79,8 +79,8 @@ async def ingest_repository(
7979 return response_content
8080
8181 except Exception as e :
82- logger .error ( f "Error during ingestion: { e } " , exc_info = True )
83- return f "Error ingesting repository: { e !s } "
82+ logger .exception ( "Error during ingestion: %s " , e )
83+ return "Error ingesting repository: An internal error occurred "
8484
8585
8686async def start_mcp_server_tcp (host : str = "0.0.0.0" , port : int = 8001 ):
@@ -142,7 +142,10 @@ async def handle_message(message: dict):
142142 "tools" : [
143143 {
144144 "name" : "ingest_repository" ,
145- "description" : "Ingest a Git repository or local directory and return a structured digest for LLMs" ,
145+ "description" : (
146+ "Ingest a Git repository or local directory "
147+ "and return a structured digest for LLMs"
148+ ),
146149 "inputSchema" : {
147150 "type" : "object" ,
148151 "properties" : {
@@ -181,13 +184,14 @@ async def handle_message(message: dict):
181184 },
182185 )
183186 except Exception as e :
187+ logger .exception ("Tool execution failed: %s" , e )
184188 return JSONResponse (
185189 {
186190 "jsonrpc" : "2.0" ,
187191 "id" : message .get ("id" ),
188192 "error" : {
189193 "code" : - 32603 ,
190- "message" : f "Tool execution failed: { e !s } " ,
194+ "message" : "Tool execution failed" ,
191195 },
192196 },
193197 )
@@ -217,14 +221,14 @@ async def handle_message(message: dict):
217221 )
218222
219223 except Exception as e :
220- logger .error ( f "Error handling MCP message: { e } " , exc_info = True )
224+ logger .exception ( "Error handling MCP message: %s " , e )
221225 return JSONResponse (
222226 {
223227 "jsonrpc" : "2.0" ,
224228 "id" : message .get ("id" ) if "message" in locals () else None ,
225229 "error" : {
226230 "code" : - 32603 ,
227- "message" : f "Internal error: { e !s } " ,
231+ "message" : "Internal server error " ,
228232 },
229233 },
230234 )
0 commit comments