Skip to main content
Glama
JDJR2024

Markdownify MCP Server - UTF-8 Enhanced

by JDJR2024

get-markdown-file

Retrieve Markdown content from an absolute file path using the get-markdown-file tool. Ideal for extracting and converting documents into Markdown format with enhanced UTF-8 support.

Instructions

Get a markdown file by absolute file path

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filepathYesAbsolute path to file of markdown'd text

Implementation Reference

  • Handler logic in the tool call switch statement that validates input and calls Markdownify.get() to retrieve the markdown file content.
    case tools.GetMarkdownFileTool.name:
      if (!validatedArgs.filepath) {
        throw new Error("File path is required for this tool");
      }
      result = await Markdownify.get({
        filePath: validatedArgs.filepath,
      });
      break;
  • Input schema definition for the get-markdown-file tool, specifying the filepath parameter.
    export const GetMarkdownFileTool = ToolSchema.parse({
      name: "get-markdown-file",
      description: "Get a markdown file by absolute file path",
      inputSchema: {
        type: "object",
        properties: {
          filepath: {
            type: "string",
            description: "Absolute path to file of markdown'd text",
          },
        },
        required: ["filepath"],
      },
    });
  • Core implementation of reading a markdown file by path and returning its path and text content.
    static async get({
      filePath,
    }: {
      filePath: string;
    }): Promise<MarkdownResult> {
      if (!fs.existsSync(filePath)) {
        throw new Error("File does not exist");
      }
    
      const text = await fs.promises.readFile(filePath, "utf-8");
    
      return {
        path: filePath,
        text: text,
      };
    }
Install Server

Other Tools

Related 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/JDJR2024/markdownify-mcp-utf8'

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