Skip to main content
Glama

get_document_structure

Extract headings and paragraphs to analyze document organization and content flow in Word documents.

Instructions

Get the structure/outline of the document (headings and paragraphs)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
docIdYesDocument identifier

Implementation Reference

  • Handler for the 'get_document_structure' tool: calls documentManager.getDocumentStructure with docId from args and returns the structure as formatted text content.
    case "get_document_structure": const structure = documentManager.getDocumentStructure(args.docId); return { content: [ { type: "text", text: `Document structure:\n${structure}`, }, ], };
  • Core implementation of document structure generation: retrieves document, iterates over paragraphs, extracts style and text preview, joins into string outline.
    getDocumentStructure(docId: string): string { const docInfo = this.getDocument(docId); const structure: string[] = []; docInfo.paragraphs.forEach((para: any, index) => { const style = para.properties?.style || "Normal"; let text = ""; if (para.root && para.root.length > 0) { text = para.root.map((r: any) => r.text || "").join(""); } if (text) { structure.push(`[${index}] ${style}: ${text.substring(0, 50)}...`); } }); return structure.join("\n"); }
  • Tool registration entry defining name, description, and input schema (docId required) for 'get_document_structure'.
    name: "get_document_structure", description: "Get the structure/outline of the document (headings and paragraphs)", inputSchema: { type: "object", properties: { docId: { type: "string", description: "Document identifier", }, }, required: ["docId"], }, },
  • Input schema validation for 'get_document_structure' tool: requires docId string.
    inputSchema: { type: "object", properties: { docId: { type: "string", description: "Document identifier", }, }, required: ["docId"], }, },

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/bibash44/word-documet-mcp-server'

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