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
| Name | Required | Description | Default |
|---|---|---|---|
| filepath | Yes | Absolute path to file of markdown'd text |
Input Schema (JSON Schema)
{
"properties": {
"filepath": {
"description": "Absolute path to file of markdown'd text",
"type": "string"
}
},
"required": [
"filepath"
],
"type": "object"
}
Implementation Reference
- src/server.ts:76-83 (handler)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;
- src/tools.ts:141-154 (schema)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"], }, });
- src/Markdownify.ts:94-109 (helper)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, }; }