MCPcopy Index your code
hub / github.com/VectifyAI/PageIndex / get_document_structure

Function get_document_structure

pageindex/retrieve.py:100–107  ·  view source on GitHub ↗

Return tree structure JSON with text fields removed (saves tokens).

(documents: dict, doc_id: str)

Source from the content-addressed store, hash-verified

98
99
100def get_document_structure(documents: dict, doc_id: str) -> str:
101 """Return tree structure JSON with text fields removed (saves tokens)."""
102 doc_info = documents.get(doc_id)
103 if not doc_info:
104 return json.dumps({'error': f'Document {doc_id} not found'})
105 structure = doc_info.get('structure', [])
106 structure_no_text = remove_fields(structure, fields=['text'])
107 return json.dumps(structure_no_text, ensure_ascii=False)
108
109
110def get_page_content(documents: dict, doc_id: str, pages: str) -> str:

Callers 1

Calls 1

remove_fieldsFunction · 0.90

Tested by

no test coverage detected