docx-queryObjects
Retrieve detailed information about top-level objects in a Word document by specifying an object ID. Use this tool to efficiently manage and query document elements within the DOCX MCP Server environment.
Instructions
List top-level object info by id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/index.ts:178-181 (handler)Direct handler for the 'docx-queryObjects' tool call within the MCP server request handler switch statement. Parses arguments using the tool's input schema and delegates execution to DocRegistry.queryObjects(id).case "docx-queryObjects": { const { id } = parseArgs<{ id: string }>(args, tools["docx-queryObjects"].inputSchema); return ok(registry.queryObjects(id)); }
- src/docx-utils.ts:195-203 (helper)Core implementation of queryObjects in DocRegistry class. Retrieves the managed document, maps over its content array to produce a list of top-level objects with their index and type, and returns count and objects array.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:53-56 (registration)Tool registration entry in the tools object, defining the name, description, and input schema used for listing tools and validating parameters."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, defining the required 'id' parameter of type string. Referenced in registration and used for argument validation.inputSchema: { type: "object", required: ["id"], properties: { id: { type: "string" } } } },