Skip to main content
Glama

Inspect Doc Structure

inspect_doc_structure
Read-onlyIdempotent

Inspect a Google Doc's structure to find safe insertion points for tables and locate existing elements. Use before creating tables to get the maximum safe index.

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

TableJSON Schema
NameRequiredDescriptionDefault
user_google_emailYesUser's Google email address
document_idYesID of the document to inspect
detailedNoWhether to return detailed structure information
tab_idNoOptional ID of the tab to inspect. If not provided, inspects main document.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true and destructiveHint=false, indicating safe, non-destructive behavior. The description adds significant context: it reveals that the tool returns document structure details, explains its critical role in safe insertion, and describes output fields like total_length. It also warns against inventing IDs and clarifies that the tool is for inspection only. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (USE THIS FOR, CRITICAL FOR TABLE OPERATIONS, WHAT THE OUTPUT SHOWS, workflows). It is appropriately sized for the tool's complexity, with each section adding unique value. The essential purpose is front-loaded, and the workflow steps are concise yet complete.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (document structure inspection for safe insertion), the description is comprehensive. It covers multiple workflows (table insertion, formatting, header/footer editing), explains output details, and addresses edge cases like tabs. Since the tool has an output schema, the description's explanation of return fields (total_elements, tables, headers/footers, etc.) is sufficient for an agent to use the output effectively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds minimal new meaning beyond the schema: it mentions using 'detail=true' in the formatting workflow and implies that tab_id is optional. However, it does not elaborate on user_google_email or document_id beyond the schema definitions. The output-focused descriptions (like total_length) do not directly enhance parameter semantics.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'finding safe insertion points and understanding document structure'. It specifies the verb 'inspect' and resource 'doc structure'. It distinguishes from siblings by emphasizing its role as 'Essential tool for finding safe insertion points' and explicitly positioning it as a prerequisite for table operations, differentiating it from tools like debug_table_structure or get_doc_content.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'USE THIS FOR' lists five specific scenarios. It also provides alternatives: 'For ordinary header/footer text, use update_doc_headers_footers' and 'If you need low-level segment editing, call this tool first'. The table insertion workflow instructs to ALWAYS call before creating tables, and the formatting workflow specifies when to call with detailed=true.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chadvdwww-hash/worksuite-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server