list_hwp_bindata
List image and binary attachments inside an .hwpx file to inspect contents before replacing images.
Instructions
List ZIP entries under BinData/ inside an .hwpx (image and binary attachments). Useful before replace_hwp_image. Args: file_path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes |
Implementation Reference
- src/tools/replace-image.ts:65-81 (handler)The main handler function for the 'list_hwp_bindata' tool. Validates file existence, ensures format is .hwpx, then calls listHwpxBinDataEntries to list BinData entries.
export async function listHwpBinData(args: ListBinDataArgs): Promise<string> { if (!existsSync(args.file_path)) { return `파일을 찾을 수 없습니다 (file not found): ${args.file_path}`; } let fmt; try { fmt = getFormatFromPath(args.file_path); } catch (e) { return (e as Error).message; } if (fmt !== "hwpx") { return "v0.2은 .hwpx 만 지원 (BinData listing requires .hwpx in v0.2)."; } const entries = await listHwpxBinDataEntries(args.file_path); if (entries.length === 0) return "(BinData 엔트리 없음 / no BinData entries)"; return entries.map((e, i) => `${i + 1}. ${e}`).join("\n"); } - src/core/hwpx-mutate.ts:149-155 (helper)The core utility that lists BinData/ entries inside a .hwpx ZIP archive by reading the file and filtering ZIP entries starting with 'BinData/'.
export async function listHwpxBinDataEntries(inputPath: string): Promise<string[]> { const bytes = await readFile(inputPath); const zip = await JSZip.loadAsync(bytes); return Object.keys(zip.files) .filter((n) => n.startsWith("BinData/")) .sort(); } - src/tools/replace-image.ts:61-63 (schema)TypeScript interface defining the input schema (only file_path string required).
export interface ListBinDataArgs { file_path: string; } - src/server.ts:165-173 (registration)Tool registration in the tools array: name, description, and inputSchema (JSON Schema) for list_hwp_bindata.
name: "list_hwp_bindata", description: "List ZIP entries under BinData/ inside an .hwpx (image and binary attachments). Useful before replace_hwp_image. Args: file_path.", inputSchema: { type: "object", properties: { file_path: { type: "string" } }, required: ["file_path"], }, }, - src/server.ts:524-524 (registration)Mapping the tool name to its handler function in the server's tool handler lookup.
list_hwp_bindata: listHwpBinData, - src/server.ts:16-16 (registration)Import statement pulling listHwpBinData from src/tools/replace-image.ts.
import { replaceHwpImage, listHwpBinData } from "./tools/replace-image.js";