MCPcopy
hub / github.com/volcengine/MineContext / convert_resp

Function convert_resp

opencontext/server/utils.py:28–40  ·  view source on GitHub ↗

Convert response to standard JSON format

(data: Any = None, code: int = 0, status: int = 200, message: str = "success")

Source from the content-addressed store, hash-verified

26
27
28def convert_resp(data: Any = None, code: int = 0, status: int = 200, message: str = "success"):
29 """Convert response to standard JSON format"""
30 content = {
31 "code": code,
32 "status": status,
33 "message": message,
34 }
35 if data is not None:
36 content["data"] = data
37
38 # Use CustomJSONEncoder to handle datetime and other special types
39 json_content = json.dumps(content, cls=CustomJSONEncoder)
40 return JSONResponse(status_code=status, content=json.loads(json_content))

Callers 15

vector_searchFunction · 0.90
upload_documentFunction · 0.90
upload_weblinkFunction · 0.90
add_screenshotFunction · 0.90
add_screenshotsFunction · 0.90
fetch_and_clear_eventsFunction · 0.90
get_event_statusFunction · 0.90
publish_eventFunction · 0.90
get_debug_reportsFunction · 0.90
get_debug_todosFunction · 0.90
get_debug_activitiesFunction · 0.90
get_debug_tipsFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected