Skip to main content
Glama

delete_hwp_table_column

Removes a specified column from a table in an .hwpx file. Provide the file path, table index, and column index to delete the column.

Instructions

Delete the Mth column (0-based) from the Nth table in an .hwpx (removes one hp:tc from every row). Args: file_path, table_index, col_index, output_path (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
table_indexYes
col_indexYes
output_pathNo

Implementation Reference

  • Main handler for the delete_hwp_table_column tool. Validates input, computes output path, calls deleteHwpxTableColumn from core, and returns a result string.
    export async function deleteHwpTableColumn(args: DeleteColumnArgs): 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, "col-deleted");
      try {
        const r = await deleteHwpxTableColumn(args.file_path, out, args.table_index, args.col_index);
        return `표 ${args.table_index} 열 ${args.col_index} 삭제 (deleted) — ${r.rowsAffected}행 영향\n저장 (saved): ${out}`;
      } catch (e) {
        return `표 열 삭제 오류 (delete column error): ${(e as Error).message}`;
      }
    }
  • TypeScript interface for the DeleteColumnArgs, defining the input schema (file_path, table_index, col_index, output_path optional).
    export interface DeleteColumnArgs {
      file_path: string;
      table_index: number;
      col_index: number;
      output_path?: string;
    }
  • src/server.ts:337-350 (registration)
    Registration of the delete_hwp_table_column tool in the MCP server tools array, with its description and JSON input schema.
    {
      name: "delete_hwp_table_column",
      description:
        "Delete the Mth column (0-based) from the Nth table in an .hwpx (removes one <hp:tc> from every row). Args: file_path, table_index, col_index, output_path (optional).",
      inputSchema: {
        type: "object",
        properties: {
          file_path: { type: "string" },
          table_index: { type: "number" },
          col_index: { type: "number" },
          output_path: { type: "string" },
        },
        required: ["file_path", "table_index", "col_index"],
      },
  • Core utility function that performs the actual column deletion in the .hwpx XML. Loads the zip, finds the table by index, removes the <hp:tc> element at the given col_index from each row, and writes the result.
    export async function deleteHwpxTableColumn(
      inputPath: string,
      outputPath: string,
      tableIndex: number,
      colIndex: number
    ): Promise<{ removed: number; rowsAffected: 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) {
        throw new Error(`Table index out of range: ${tableIndex}`);
      }
      const tableXml = tables[tableIndex][0];
      const trRegex = /<hp:tr(?:\s[^>]*)?>[\s\S]*?<\/hp:tr>/g;
      const trs = [...tableXml.matchAll(trRegex)];
      let newTableXml = tableXml;
      let affected = 0;
      for (let r = 0; r < trs.length; r++) {
        const trXml = trs[r][0];
        const tcMatches = [...trXml.matchAll(/<hp:tc(?:\s[^>]*)?>[\s\S]*?<\/hp:tc>/g)];
        if (colIndex < 0 || colIndex >= tcMatches.length) continue;
        const target = tcMatches[colIndex][0];
        const newTrXml = trXml.replace(target, "");
        newTableXml = newTableXml.replace(trXml, newTrXml);
        affected++;
      }
      const newXml = xml.replace(tableXml, newTableXml);
      await writeSection(zip, sectionName, newXml, outputPath);
      return { removed: 1, rowsAffected: affected };
    }
  • src/server.ts:531-532 (registration)
    Tool name-to-function mapping in the server's handler dispatch object.
    delete_hwp_table_column: deleteHwpTableColumn,
    insert_hwp_image: insertHwpImage,
Behavior3/5

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

With no annotations, the description carries the full burden. It explains the core operation (removing one <hp:tc> from every row) and specifies zero-based indexing. However, it does not disclose side effects like whether modifications are saved automatically, what happens on error, or permissions required. This leaves gaps for an AI agent.

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 one sentence plus a list of arguments. It front-loads the action and every word adds value. There is no redundancy or fluff.

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?

The tool modifies an .hwpx file. The description does not mention return value, error handling, file locking, or behavior when output_path is omitted. Given the complexity of file manipulation, more details are needed for safe usage.

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 description coverage is 0%. The description lists parameter names and indicates output_path is optional, and clarifies that table_index and col_index are zero-based. However, it does not explain file_path format, allowed values, or constraints. This is minimal improvement over the schema.

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 clearly states the action ('Delete the Mth column'), the resource ('.hwpx' file), and the specifics (0-based indexing, removal of <hp:tc> from every row). This distinguishes it from siblings like delete_hwp_table_row or append_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 Guidelines3/5

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

The description does not provide explicit guidance on when to use this tool versus alternatives like append_hwp_table_column or delete_hwp_table_row. The purpose is clear enough for an informed decision, but no exclusions or when-not statements are given.

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