Skip to main content
Glama

list_hwp_images

List embedded image metadata (mime type, byte length, locator) from HWP/HWPX files.

Instructions

List embedded images (mime, byte length, locator) in an HWP/HWPX file. Args: file_path.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes

Implementation Reference

  • The main handler function that lists embedded images in an HWP/HWPX file. Opens the document, walks through all images using walkImages(), and returns a formatted string listing each image's section/paragraph/control index, MIME type, byte length, and file extension.
    export async function listHwpImages(args: ListImagesArgs): Promise<string> {
      let doc;
      try {
        doc = await openDocument(args.file_path);
      } catch (e) {
        return (e as Error).message;
      }
      try {
        const imgs = walkImages(doc);
        if (imgs.length === 0) return "(이미지가 없습니다 / no images)";
        return imgs
          .map(
            (img, i) =>
              `${i + 1}. [section ${img.section}, para ${img.paragraph}, ctrl ${img.controlIdx}] ${img.mime} (${img.byteLength} bytes, .${img.ext})`
          )
          .join("\n");
      } finally {
        closeDocument(doc);
      }
    }
  • Input schema for listHwpImages: requires a file_path string.
    export interface ListImagesArgs {
      file_path: string;
    }
  • src/server.ts:69-78 (registration)
    Tool definition/registration in the SERVER_TOOLS array with name 'list_hwp_images', description, and inputSchema.
    {
      name: "list_hwp_images",
      description:
        "List embedded images (mime, byte length, locator) in an HWP/HWPX file. Args: file_path.",
      inputSchema: {
        type: "object",
        properties: { file_path: { type: "string" } },
        required: ["file_path"],
      },
    },
  • src/server.ts:513-513 (registration)
    Handler mapping in the HANDLERS record, mapping 'list_hwp_images' to the listHwpImages function.
    list_hwp_images: listHwpImages,
  • Helper function walkImages() that iterates over all sections, paragraphs, and controls in an HWP document, extracting image metadata and returning an array of ImageRef objects.
    export function walkImages(doc: HwpDocument): ImageRef[] {
      const out: ImageRef[] = [];
      const sectionCount = doc.getSectionCount();
      for (let s = 0; s < sectionCount; s++) {
        const paraCount = doc.getParagraphCount(s);
        for (let p = 0; p < paraCount; p++) {
          const n = controlCount(doc, s, p);
          for (let ci = 0; ci < n; ci++) {
            let mime: string;
            try {
              mime = doc.getControlImageMime(s, p, ci);
            } catch {
              continue;
            }
            if (!mime) continue;
            let bytes: Uint8Array;
            try {
              bytes = doc.getControlImageData(s, p, ci);
            } catch {
              continue;
            }
            out.push({
              section: s,
              paragraph: p,
              controlIdx: ci,
              mime,
              byteLength: bytes.byteLength,
              ext: extFromMime(mime),
            });
          }
        }
      }
      return out;
    }
Behavior3/5

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

The description mentions the returned data (mime, byte length, locator) implying a read operation, but does not explicitly state it does not modify the file. With no annotations, more detail on safety and error handling would improve transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very short and to the point, with the main action in the first sentence. It earns its place, but could include more context without being verbose.

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 the presence of similar sibling tools and lack of output schema, the description is insufficient for an agent to understand the exact purpose and differentiate from extract_hwp_images. It does not explain what a 'locator' is or how the output should be used.

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?

There is only one parameter (file_path) and the description adds minimal value beyond the schema, only noting it exists. The schema has 0% coverage, so the description should clarify the expected format or type of file_path.

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

Purpose4/5

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

The description clearly states it lists embedded images with specific details (mime, byte length, locator) in HWP/HWPX files. However, it does not differentiate from sibling tools like extract_hwp_images or list_hwp_bindata, which could cause confusion.

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 (e.g., extract_hwp_images), nor are there prerequisites or conditions for use. The agent must 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/treesoop/hwp-mcp'

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