Skip to main content
Glama

docx-removeContent

Remove specific content blocks from Word documents by index to edit DOCX files programmatically.

Instructions

Remove a block at index.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
indexYes

Implementation Reference

  • Core handler function in DocRegistry that removes the content block at the given index from the document's JSON content array, validates the index, updates the JSON, and triggers document rebuild via updateJson.
    removeContent(id: DocId, index: number) { return this.updateJson(id, (json) => { const arr = [...json.content]; if (index < 0 || index >= arr.length) throw new Error("index out of range"); arr.splice(index, 1); return { ...json, content: arr } as DocxJSON; }); }
  • MCP server tool call handler (switch case) that parses input arguments using the tool's schema and delegates execution to the DocRegistry.removeContent method.
    case "docx-removeContent": { const { id, index } = parseArgs<{ id: string; index: number }>(args, tools["docx-removeContent"].inputSchema); const res = registry.removeContent(id, index); return ok({ id: res.id, updatedAt: res.updatedAt }); }
  • src/index.ts:69-72 (registration)
    Tool registration in the tools object, including name, description, and inputSchema used for validation and listing tools.
    "docx-removeContent": { description: "Remove a block at index.", inputSchema: { type: "object", required: ["id", "index"], properties: { id: { type: "string" }, index: { type: "integer", minimum: 0 } } } },
  • Input schema definition for the docx-removeContent tool, specifying required id (string) and index (non-negative integer).
    inputSchema: { type: "object", required: ["id", "index"], properties: { id: { type: "string" }, index: { type: "integer", minimum: 0 } } } },

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/lihongjie0209/docx-mcp'

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