Skip to main content
Glama

markdown

Convert web page URLs into clean, structured markdown format for content extraction and documentation purposes.

Instructions

Convert a URL to clean markdown. Costs 2 credits.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to convert to markdown

Implementation Reference

  • The handler function for the markdown tool - takes a URL parameter and calls the API POST /markdown endpoint, wrapping the result with jsonResult
    async ({ url }) => jsonResult(await apiPost("/markdown", { url }))
  • src/index.ts:125-130 (registration)
    Registration of the markdown tool with the MCP server using server.tool() - defines name, description, schema, and handler
    server.tool(
      "markdown",
      "Convert a URL to clean markdown. Costs 2 credits.",
      { url: z.string().describe("URL to convert to markdown") },
      async ({ url }) => jsonResult(await apiPost("/markdown", { url }))
    );
  • Input schema definition for markdown tool - requires a url parameter as a string with description
    { url: z.string().describe("URL to convert to markdown") },
  • Helper function apiPost that makes POST requests to the SearchClaw API - handles headers, JSON body, timeout, and error responses
    async function apiPost(path: string, body: Record<string, unknown>) {
      const controller = new AbortController();
      const timeout = setTimeout(() => controller.abort(), 30000);
      try {
        const response = await fetch(`${API_BASE}${path}`, {
          method: "POST",
          headers: { ...headers, "Content-Type": "application/json" },
          body: JSON.stringify(body),
          signal: controller.signal,
        });
        if (!response.ok) {
          const text = await response.text();
          throw new Error(`SearchClaw API error ${response.status}: ${text}`);
        }
        return response.json();
      } finally {
        clearTimeout(timeout);
      }
    }
  • Helper function jsonResult that formats API responses into MCP content format - converts data to JSON string with formatting
    function jsonResult(data: unknown) {
      return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] };
    }

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/CSteenkamp/searchclaw-mcp'

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