Skip to main content
Glama
JDJR2024

Markdownify MCP Server - UTF-8 Enhanced

by JDJR2024

webpage-to-markdown

Transform webpage content into markdown format using URL input. Ideal for simplifying web content into readable, structured Markdown with enhanced UTF-8 support.

Instructions

Convert a webpage to markdown

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL of the webpage to convert

Implementation Reference

  • Handler logic in the CallToolRequest handler for URL-based tools (YouTube, Bing search, webpage-to-markdown): validates the URL argument and delegates to Markdownify.toMarkdown for conversion.
    case tools.YouTubeToMarkdownTool.name:
    case tools.BingSearchResultToMarkdownTool.name:
    case tools.WebpageToMarkdownTool.name:
      if (!validatedArgs.url) {
        throw new Error("URL is required for this tool");
      }
      result = await Markdownify.toMarkdown({
        url: validatedArgs.url,
        projectRoot: validatedArgs.projectRoot,
        uvPath: validatedArgs.uvPath || process.env.UV_PATH,
      });
      break;
  • Input schema definition for the webpage-to-markdown tool, specifying the required 'url' parameter.
    export const WebpageToMarkdownTool = ToolSchema.parse({
      name: "webpage-to-markdown",
      description: "Convert a webpage to markdown",
      inputSchema: {
        type: "object",
        properties: {
          url: {
            type: "string",
            description: "URL of the webpage to convert",
          },
        },
        required: ["url"],
      },
    });
  • src/server.ts:31-35 (registration)
    Tool registration via ListToolsRequestSchema handler, exposing all tools from tools.ts including webpage-to-markdown.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: Object.values(tools),
      };
    });
  • Core helper function Markdownify.toMarkdown that handles webpage conversion: fetches HTML from URL, saves to temporary file, processes it using the _markitdown method (which executes markitdown tool), and returns the markdown file path and content.
    static async toMarkdown({
      filePath,
      url,
      projectRoot = path.resolve(__dirname, ".."),
      uvPath = "~/.local/bin/uv",
    }: {
      filePath?: string;
      url?: string;
      projectRoot?: string;
      uvPath?: string;
    }): Promise<MarkdownResult> {
      try {
        let inputPath: string;
        let isTemporary = false;
    
        if (url) {
          const response = await fetch(url);
          const content = await response.text();
          inputPath = await this.saveToTempFile(content);
          isTemporary = true;
        } else if (filePath) {
          inputPath = filePath;
        } else {
          throw new Error("Either filePath or url must be provided");
        }
    
        const text = await this._markitdown(inputPath, projectRoot, uvPath);
        const outputPath = await this.saveToTempFile(text);
    
        if (isTemporary) {
          fs.unlinkSync(inputPath);
        }
    
        return { path: outputPath, text };
      } catch (e: unknown) {
        if (e instanceof Error) {
          throw new Error(`Error processing to Markdown: ${e.message}`);
        } else {
          throw new Error("Error processing to Markdown: Unknown error occurred");
        }
      }
    }
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. It states the conversion action but lacks details on traits like error handling (e.g., invalid URLs, network issues), performance (e.g., timeouts, size limits), or output specifics (e.g., markdown format quality, included elements). This is a significant gap for a tool with no structured safety hints.

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 extremely concise—a single, direct sentence with zero wasted words. It's front-loaded with the core action, making it easy to parse quickly. Every word earns its place by conveying the essential purpose without fluff.

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?

Given the tool's complexity (conversion operation), lack of annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like what happens on failure, what the markdown output includes, or limitations (e.g., dynamic content handling). For a tool with no structured safety or output info, more context is needed.

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 'url' fully documented in the schema. The description adds no additional meaning beyond implying the URL is for a webpage, which is already clear from the schema. This meets the baseline score when the schema does the heavy lifting.

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 tool's purpose with a specific verb ('Convert') and resource ('a webpage to markdown'), making it immediately understandable. However, it doesn't distinguish this tool from its siblings (e.g., 'pdf-to-markdown', 'docx-to-markdown'), which all convert different content types to markdown, so it doesn't reach the highest score.

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. It doesn't mention any prerequisites (e.g., URL accessibility), exclusions (e.g., unsupported webpage types), or comparisons to sibling tools like 'bing-search-to-markdown' for web content. This leaves the agent with minimal 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

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