Skip to main content
Glama

Convert HWP content to Markdown

convert_hwp_content_to_md
Read-only

Convert Base64-encoded HWP or HWPX file content to Markdown format for analysis and processing, using the original filename for format detection.

Instructions

Base64로 인코딩된 HWP 또는 HWPX 파일 내용을 Markdown으로 변환합니다. 파일 경로 대신 파일 내용을 직접 전달할 때 사용합니다. filename은 포맷 감지를 위해 .hwp 또는 .hwpx 확장자를 포함해야 합니다.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYesBase64로 인코딩된 HWP 또는 HWPX 파일 내용
filenameYes원본 파일명 (.hwp 또는 .hwpx 확장자 포함, 포맷 감지용)

Implementation Reference

  • Main tool registration and handler implementation - defines registerConvertContentTool function that registers 'convert_hwp_content_to_md' tool with MCP server and contains the async handler that processes content conversion requests
    export function registerConvertContentTool(
      server: McpServer,
      apiClient: HwpApiClient
    ): void {
      server.registerTool(
        "convert_hwp_content_to_md",
        {
          title: "Convert HWP content to Markdown",
          description:
            "Base64로 인코딩된 HWP 또는 HWPX 파일 내용을 Markdown으로 변환합니다. " +
            "파일 경로 대신 파일 내용을 직접 전달할 때 사용합니다. " +
            "filename은 포맷 감지를 위해 .hwp 또는 .hwpx 확장자를 포함해야 합니다.",
          inputSchema: {
            content: z
              .string()
              .describe("Base64로 인코딩된 HWP 또는 HWPX 파일 내용"),
            filename: z
              .string()
              .describe(
                "원본 파일명 (.hwp 또는 .hwpx 확장자 포함, 포맷 감지용)"
              ),
          },
          annotations: {
            readOnlyHint: true,
            openWorldHint: true,
          },
        },
        async ({ content, filename }) => {
          try {
            const ext = filename.toLowerCase();
            if (!ext.endsWith(".hwp") && !ext.endsWith(".hwpx")) {
              return {
                content: [
                  {
                    type: "text" as const,
                    text: "오류: 파일명은 .hwp 또는 .hwpx 확장자를 포함해야 합니다.",
                  },
                ],
                isError: true,
              };
            }
    
            const result = await apiClient.convertContent(content, filename);
            return {
              content: [
                {
                  type: "text" as const,
                  text: result.markdown,
                },
              ],
            };
          } catch (error) {
            const message =
              error instanceof Error ? error.message : String(error);
            return {
              content: [
                {
                  type: "text" as const,
                  text: `변환 실패: ${message}`,
                },
              ],
              isError: true,
            };
          }
        }
      );
    }
  • Input schema definition - Zod schema validating 'content' (base64-encoded HWP/HWPX file) and 'filename' (must have .hwp or .hwpx extension)
    inputSchema: {
      content: z
        .string()
        .describe("Base64로 인코딩된 HWP 또는 HWPX 파일 내용"),
      filename: z
        .string()
        .describe(
          "원본 파일명 (.hwp 또는 .hwpx 확장자 포함, 포맷 감지용)"
        ),
    },
  • API client methods that perform the actual conversion - convertContent converts base64 string to Buffer and calls sendConvertRequest which makes HTTP POST to /api/v1/convert endpoint
    async convertContent(
      base64Content: string,
      filename: string
    ): Promise<ConvertResult> {
      const fileBuffer = Buffer.from(base64Content, "base64");
      return this.sendConvertRequest(fileBuffer, filename);
    }
    
    private async sendConvertRequest(
      fileBuffer: Buffer,
      filename: string
    ): Promise<ConvertResult> {
      const formData = new FormData();
      const blob = new Blob([new Uint8Array(fileBuffer)], { type: "application/octet-stream" });
      formData.append("file", blob, filename);
    
      const response = await fetch(`${this.baseUrl}/api/v1/convert`, {
        method: "POST",
        body: formData,
      });
    
      if (!response.ok) {
        const errorText = await response.text();
        throw new Error(`HWP API error (${response.status}): ${errorText}`);
      }
    
      return (await response.json()) as ConvertResult;
    }
  • Type definition for conversion result - ConvertResult interface defining the structure of API response with filename and markdown fields
    export interface ConvertResult {
      filename: string;
      markdown: string;
    }
Behavior3/5

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

Annotations indicate readOnlyHint=true and openWorldHint=true, covering safety and flexibility. The description adds context about filename requirements for format detection, but does not detail conversion limitations, error handling, or output specifics, leaving some behavioral aspects unclear.

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 front-loaded with the core purpose, followed by usage context and parameter guidance, all in three concise sentences with no wasted words, making it highly efficient.

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?

Given the tool's moderate complexity, lack of output schema, and rich annotations, the description covers purpose, usage, and key parameter context well. However, it could be more complete by mentioning conversion accuracy or output format details, though annotations help mitigate this gap.

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 100%, so parameters are fully documented in the schema. The description reiterates the purpose of content and filename but does not add significant semantic details beyond what the schema provides, aligning with the baseline for high coverage.

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 specific action ('convert'), resource ('Base64-encoded HWP or HWPX file content'), and output format ('Markdown'), and distinguishes it from sibling tools by specifying 'when file content is passed directly instead of file path'.

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

Usage Guidelines5/5

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

It explicitly states when to use this tool ('when file content is passed directly instead of file path'), which implicitly suggests the alternative (sibling tool convert_hwp_to_md) is for file paths, providing clear context for selection.

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/beomzh/hwpConverMdMCP'

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