MCPcopy Create free account
hub / github.com/microsoft/data-formulator / knowledge_read

Function knowledge_read

py-src/data_formulator/routes/knowledge.py:77–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

75
76@knowledge_bp.route("/read", methods=["POST"])
77def knowledge_read():
78 data = request.get_json(silent=True) or {}
79 category = _require_json_field(data, "category")
80 path = _require_json_field(data, "path")
81
82 store = _get_store()
83 try:
84 content = store.read(category, path)
85 except ValueError as exc:
86 raise AppError(ErrorCode.INVALID_REQUEST, str(exc)) from exc
87 except FileNotFoundError:
88 raise AppError(ErrorCode.TABLE_NOT_FOUND, "Knowledge file not found")
89
90 return json_ok({"content": content, "category": category, "path": path})
91
92
93# ── write ─────────────────────────────────────────────────────────────────

Callers

nothing calls this directly

Calls 5

AppErrorClass · 0.90
json_okFunction · 0.90
_require_json_fieldFunction · 0.85
_get_storeFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected