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 } } }
    },
Behavior2/5

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

With no annotations, the description carries the full burden of behavioral disclosure. 'Remove' implies a destructive mutation, but it doesn't specify if the removal is permanent, reversible, or requires specific permissions. No additional context like rate limits or error handling is provided, making it insufficient for a mutation tool.

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 a single, efficient sentence with zero waste. It's appropriately sized and front-loaded, though its brevity contributes to under-specification rather than clarity.

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

Completeness2/5

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

For a destructive mutation tool with no annotations, 0% schema coverage, and no output schema, the description is incomplete. It lacks details on behavior, parameters, and expected outcomes, failing to provide enough context for reliable agent use.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate, but it only mentions 'index' and implies 'id' as a document identifier without explaining their roles. It doesn't clarify what 'block' refers to or how indexing works, leaving key parameters undocumented.

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

Purpose3/5

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

The description 'Remove a block at index' states a verb ('Remove') and resource ('a block'), but it's vague about what 'block' means in the context of DOCX documents and doesn't distinguish from siblings like docx-editContent or docx-insertContent. It's minimally adequate but lacks specificity about the document operation.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like docx-editContent or docx-insertContent. The description doesn't mention prerequisites, such as needing an open document, or exclusions, leaving the agent to infer usage from the tool name alone.

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

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