docx-queryObjects
Retrieve top-level object information by ID from Word documents to inspect document structure and content elements.
Instructions
List top-level object info by id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/docx-utils.ts:195-203 (handler)Core implementation of queryObjects in DocRegistry: maps document content to array of {index, type} and returns with count.queryObjects(id: DocId) { const cur = this.require(id); // Return a simplified view of objects from JSON (paragraphs, tables, images) const objects = cur.json.content.map((block, idx) => ({ index: idx, type: block.type, })); return { count: objects.length, objects }; }
- src/index.ts:178-181 (handler)MCP server switch case handler for docx-queryObjects: validates input and calls registry.queryObjects(id).case "docx-queryObjects": { const { id } = parseArgs<{ id: string }>(args, tools["docx-queryObjects"].inputSchema); return ok(registry.queryObjects(id)); }
- src/index.ts:53-56 (registration)Tool registration in tools object: defines name, description, and inputSchema requiring 'id' string."docx-queryObjects": { description: "List top-level object info by id.", inputSchema: { type: "object", required: ["id"], properties: { id: { type: "string" } } } },
- src/index.ts:55-56 (schema)Input schema for the tool: object with required 'id' property of type string.inputSchema: { type: "object", required: ["id"], properties: { id: { type: "string" } } } },