inspect_doc_structure
Analyzes Google Docs structure to identify safe insertion points for tables, locate existing elements, and obtain document statistics for precise editing operations.
Instructions
Essential tool for finding safe insertion points and understanding document structure.
USE THIS FOR:
Finding the correct index for table insertion
Understanding document layout before making changes
Locating existing tables and their positions
Getting document statistics and complexity info
Inspecting structure of specific tabs
CRITICAL FOR TABLE OPERATIONS: ALWAYS call this BEFORE creating tables to get a safe insertion index.
WHAT THE OUTPUT SHOWS:
total_elements: Number of document elements
total_length: Maximum safe index for insertion
tables: Number of existing tables
table_details: Position and dimensions of each table
headers / footers: Real segment IDs and previews for header/footer editing
tabs: List of available tabs in the document (if no tab_id specified)
WORKFLOW FOR TABLE INSERTION: Step 1: Call this function Step 2: Note the "total_length" value Step 3: Use an index < total_length for table insertion Step 4: Create your table
FORMATTING WORKFLOW: After inserting all text via batch_update_doc with end_of_segment=true, call this tool with detailed=true to get exact start_index and end_index for every paragraph. Use those indices directly in format_text and update_paragraph_style operations in a second batch_update_doc call.
HEADER/FOOTER WORKFLOW: For ordinary header/footer text, use update_doc_headers_footers. If you need low-level segment editing, call this tool first and use the real segment_id values returned under headers/footers. Do not invent IDs.
The detailed output includes elements[].start_index and elements[].end_index with text_preview for each paragraph, making it easy to identify which ranges to format.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | User's Google email address | |
| document_id | Yes | ID of the document to inspect | |
| detailed | No | Whether to return detailed structure information | |
| tab_id | No | Optional ID of the tab to inspect. If not provided, inspects main document. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |