Skip to main content
Glama

list_hwp_fields

List Hancom-style fields from a document to identify field names and types for template filling.

Instructions

List Hancom-style fields (<hp:fldBegin>/end pairs) in the document, with name and type when available. Useful before fill_hwp_template. Args: file_path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Implementation Reference

  • The actual handler function `listHwpFields` that opens a document, calls `doc.getFieldList()`, parses the JSON result, and returns a formatted list of all Hancom-style fields in the document.
    export async function listHwpFields(args: FilePathArgs): Promise<string> {
      let doc;
      try {
        doc = await openDocument(args.file_path);
      } catch (e) {
        return (e as Error).message;
      }
      try {
        let raw: string;
        try {
          raw = doc.getFieldList();
        } catch (e) {
          return `필드 목록 오류 (field list error): ${(e as Error).message}`;
        }
        let list: any[] = [];
        try {
          list = JSON.parse(raw);
        } catch {
          return raw; // return as-is if not JSON
        }
        if (!Array.isArray(list) || list.length === 0) {
          return "(필드가 없습니다 / no fields)";
        }
        return list
          .map((f, i) => {
            const name = f?.name ?? f?.field_name ?? f?.fieldName ?? "?";
            const type = f?.type ?? f?.fieldType ?? "";
            const value = f?.value ?? "";
            return `${i + 1}. ${name}${type ? ` [${type}]` : ""}${value ? ` = ${String(value).slice(0, 40)}` : ""}`;
          })
          .join("\n");
      } finally {
        closeDocument(doc);
      }
    }
  • The `FilePathArgs` interface used as input schema for list_hwp_fields (requires a `file_path` string).
    export interface FilePathArgs {
      file_path: string;
    }
  • src/server.ts:155-163 (registration)
    Tool registration in the TOOLS array with name 'list_hwp_fields', description, and inputSchema (file_path string required).
      name: "list_hwp_fields",
      description:
        "List Hancom-style fields (`<hp:fldBegin>`/end pairs) in the document, with name and type when available. Useful before fill_hwp_template. Args: file_path.",
      inputSchema: {
        type: "object",
        properties: { file_path: { type: "string" } },
        required: ["file_path"],
      },
    },
  • src/server.ts:522-522 (registration)
    Handler mapping in the HANDLERS record that maps the string 'list_hwp_fields' to the imported `listHwpFields` function.
    list_hwp_fields: listHwpFields,
  • src/server.ts:17-17 (registration)
    Import statement that brings `listHwpFields` from './tools/info.js' into the server module.
    import { getHwpInfo, listHwpFields, getHwpFieldValue, getHwpPageDef } from "./tools/info.js";
Behavior3/5

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

With no annotations, the description should disclose behavioral traits. It implies a read-only operation but doesn't explicitly state side effects, permissions, or error handling. The description is adequate but lacks full transparency.

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 concise, consisting of two sentences that deliver essential information without unnecessary details. Every word contributes to understanding the tool's purpose and usage.

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

Completeness4/5

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

For a simple tool with one parameter and no output schema, the description provides sufficient context: what it does, what it returns, and its typical use. Minor gaps like error conditions or file type restrictions are not critical.

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?

The only parameter 'file_path' has 0% schema description coverage, and the description merely restates 'Args: file_path' without adding details on format, constraints, or expectations. It fails to compensate for the missing schema documentation.

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 tool lists Hancom-style fields with name and type when available, and references a specific use case (before fill_hwp_template), distinguishing it from sibling tools like get_hwp_field_value or set_hwp_field_value.

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

Usage Guidelines4/5

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

The description explicitly recommends using this tool before fill_hwp_template, providing a clear usage context. However, it does not mention when not to use it or suggest alternatives for other scenarios.

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