MCPcopy Create free account
hub / github.com/nlweb-ai/NLWeb / build_appsdk_error_response

Function build_appsdk_error_response

AskAgent/python/core/utils/appsdk_adapter.py:207–222  ·  view source on GitHub ↗

Create an AppSDK-compatible error payload.

(error_text: str, status: int | None = None)

Source from the content-addressed store, hash-verified

205
206
207def build_appsdk_error_response(error_text: str, status: int | None = None) -> dict[str, Any]:
208 """Create an AppSDK-compatible error payload."""
209 structured_content: dict[str, Any] = {
210 "error": {
211 "message": error_text,
212 }
213 }
214 if status is not None:
215 structured_content["error"]["status"] = status
216
217 return {
218 "structuredContent": structured_content,
219 "content": [
220 {"type": "text", "text": f"Error: {error_text}"},
221 ],
222 }
223def _stable_repr(value: Any) -> str:
224 """Generate a hashable representation for potentially nested data structures."""
225 try:

Callers 4

handle_askMethod · 0.90
_consume_streamMethod · 0.90

Calls

no outgoing calls

Tested by 1