Skip to main content
Glama

delete_hwp_table_row

Delete a specific row from a table in an HWPX file. Specify the file, table index, and row index to remove unwanted data.

Instructions

Delete the Mth row (0-based) from the Nth table (0-based) in an .hwpx. Args: file_path, table_index, row_index, output_path (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
table_indexYes
row_indexYes
output_pathNo

Implementation Reference

  • The tool handler function that validates input, calls the core mutation function (deleteHwpxTableRow), and returns a human-readable result string.
    export async function deleteHwpTableRow(args: DeleteRowArgs): Promise<string> {
      const err = preflight(args.file_path);
      if (err) return err;
      const out = args.output_path && args.output_path.length > 0
        ? args.output_path
        : defaultOutput(args.file_path, "row-deleted");
      try {
        const r = await deleteHwpxTableRow(args.file_path, out, args.table_index, args.row_index);
        if (r.deleted === 0) return `행 인덱스 범위 초과 (row index out of range): ${args.row_index} (남은 ${r.remaining})`;
        return `표 ${args.table_index} 행 ${args.row_index} 삭제 (deleted)\n남은 행: ${r.remaining}\n저장 (saved): ${out}`;
      } catch (e) {
        return `표 행 삭제 오류 (delete row error): ${(e as Error).message}`;
      }
    }
  • TypeScript interface defining the input arguments for deleteHwpTableRow.
    export interface DeleteRowArgs {
      file_path: string;
      table_index: number;
      row_index: number;
      output_path?: string;
    }
  • Core mutation helper that loads an .hwpx file, finds the Nth table and Mth row via regex, removes the row XML, and writes the modified file.
    export async function deleteHwpxTableRow(
      inputPath: string,
      outputPath: string,
      tableIndex: number,
      rowIndex: number
    ): Promise<{ deleted: number; remaining: number }> {
      const { zip, sectionName, xml } = await loadSection(inputPath);
      const tblRegex = /<hp:tbl [^>]*>[\s\S]*?<\/hp:tbl>/g;
      const tables = [...xml.matchAll(tblRegex)];
      if (tableIndex < 0 || tableIndex >= tables.length) {
        return { deleted: 0, remaining: tables.length };
      }
      const tableXml = tables[tableIndex][0];
      const trRegex = /<hp:tr(?:\s[^>]*)?>[\s\S]*?<\/hp:tr>/g;
      const trs = [...tableXml.matchAll(trRegex)];
      if (rowIndex < 0 || rowIndex >= trs.length) {
        return { deleted: 0, remaining: trs.length };
      }
      const target = trs[rowIndex][0];
      const newTableXml = tableXml.replace(target, "");
      const newXml = xml.replace(tableXml, newTableXml);
      await writeSection(zip, sectionName, newXml, outputPath);
      return { deleted: 1, remaining: trs.length - 1 };
    }
  • src/server.ts:260-274 (registration)
    MCP tool registration with name, description, and JSON Schema input validation.
    {
      name: "delete_hwp_table_row",
      description:
        "Delete the Mth row (0-based) from the Nth table (0-based) in an .hwpx. Args: file_path, table_index, row_index, output_path (optional).",
      inputSchema: {
        type: "object",
        properties: {
          file_path: { type: "string" },
          table_index: { type: "number" },
          row_index: { type: "number" },
          output_path: { type: "string" },
        },
        required: ["file_path", "table_index", "row_index"],
      },
    },
  • src/server.ts:529-529 (registration)
    The tool handler mapping in the server's tool handler object, linking the snake_case name to the imported function.
    delete_hwp_table_row: deleteHwpTableRow,
Behavior2/5

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

No annotations provided, and the description lacks details on side effects (e.g., in-place modification vs creating new file), permissions, or error conditions. The optional output_path is mentioned but not clarified.

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 sentence with a list of arguments, front-loaded and no unnecessary words. Highly efficient.

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?

Given no annotations or output schema, the description is incomplete for a deletion tool. Missing information on file modification behavior and error handling.

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

Parameters3/5

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

Schema coverage is 0%, so the description must compensate. It explains that table_index and row_index are 0-based and lists all parameters, but adds little meaning beyond the names.

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

Purpose5/5

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

The description explicitly states the action (delete a row), the resource (table in .hwpx), and specifies indexing (0-based). It distinguishes from sibling tools like delete_hwp_table_column.

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 on when to use this tool vs alternatives, nor any prerequisites or exclusions. The description only states the operation without context.

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/treesoop/hwp-mcp'

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