--- name: describe-entity description: Xem chi tiết một hồ sơ theo entity_code — metadata, danh sách files, trạng thái index. Dùng khi user hỏi sâu về một record cụ thể. --- # Describe Entity ## Khi nào dùng - "Cho tôi chi tiết hồ sơ TBMT-2026-001" - "Hồ sơ X có bao nhiêu file?" - "Trạng thái index của KHLCNT-... ?" - "File chính của hồ sơ này tên gì?" ## Workflow 1. Cần `entity_code` chính xác. Nếu user nói mơ hồ ("hồ sơ A", "cái gói thầu hôm qua"): - Hỏi lại để clarify, hoặc - Dùng `list_entities` để tìm trước rồi xác nhận với user. 2. Gọi `describe_entity(entity_code="")`. 3. Xử lý lỗi: - Tool raise `entity_not_found` → thông báo user "Không tìm thấy hồ sơ ", gợi ý dùng `list_entities` để xem danh sách. 4. Nếu OK: trả lời gồm: - Metadata: type, status, ngày tạo / cập nhật. - Bảng files: mỗi row có `id` (cần cho `fetch-raw-file`), `file_name`, `file_type`, `size`. ## Ví dụ **User:** "Chi tiết hồ sơ TBMT-2026-001" **Agent:** ``` → describe_entity(entity_code="TBMT-2026-001") ← {entity: {...}, files: [{id: 10, file_name: "main.pdf", ...}, ...]} ``` **Reply:** metadata + bảng files với cột `id` để user/agent có thể tham chiếu khi cần download. ## Anti-patterns - ❌ Đừng đoán entity_code — phải hỏi nếu user mơ hồ. - ❌ Đừng tóm tắt nội dung file dựa vào file_name — đó là việc của `search_procurement_docs`. - ❌ Đừng giấu `id` của file — agent/user cần `id` để tải file gốc qua `fetch_raw_file_url`.