Skip to main content
Glama

get-markdown-file

Retrieve Markdown content from files using absolute file paths to access and work with formatted text documents.

Instructions

Get a markdown file by absolute file path

Input Schema

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

Implementation Reference

  • Defines the ToolSchema for 'get-markdown-file', including name, description, and input schema requiring 'filepath'.
    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"],
      },
    });
  • Dispatches the tool call to Markdownify.get with the provided filepath, handling validation and error.
    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;
  • Core implementation that validates the markdown file path (extension, existence, share dir), reads the file content using fs.promises.readFile, and returns path and text.
    static async get({
      filePath,
    }: {
      filePath: string;
    }): Promise<MarkdownResult> {
      // Check file type is *.md or *.markdown
      const normPath = this.normalizePath(path.resolve(expandHome(filePath)));
      const markdownExt = [".md", ".markdown"];
      if (!markdownExt.includes(path.extname(normPath))) {
        throw new Error("Required file is not a Markdown file.");
      }
    
      if (process.env?.MD_SHARE_DIR) {
        const allowedShareDir = this.normalizePath(
          path.resolve(expandHome(process.env.MD_SHARE_DIR)),
        );
        if (!normPath.startsWith(allowedShareDir)) {
          throw new Error(`Only files in ${allowedShareDir} are allowed.`);
        }
      }
    
      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,
      };
    }
  • src/server.ts:33-37 (registration)
    Registers all tools from tools.ts (including GetMarkdownFileTool) for the listTools capability.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: Object.values(tools),
      };
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While 'Get' implies a read operation, the description doesn't specify what happens if the file doesn't exist, permission requirements, file size limitations, or what format the content is returned in. This leaves significant behavioral questions unanswered.

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 a single, efficient sentence that communicates the core functionality without any wasted words. It's appropriately front-loaded with the essential information and earns its place with clear communication.

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?

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success (what format is returned?), what happens on failure (error handling), or how it differs from sibling conversion tools. The context signals indicate this is a simple tool, but the description leaves too many operational questions unanswered.

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?

The schema description coverage is 100%, with the single parameter 'filepath' well-documented in the schema as 'Absolute path to file of markdown'd text.' The description adds no additional parameter information beyond what's already in the schema, so the baseline score of 3 is appropriate.

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 the action ('Get') and resource ('a markdown file by absolute file path'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools that convert various formats to markdown, as this tool retrieves existing markdown files rather than converting content.

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?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools focused on converting various formats to markdown, there's no indication of whether this tool is for retrieving pre-existing markdown files or how it relates to those conversion tools.

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/zcaceres/markdownify-mcp'

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