convert_to_markdown
Transform web pages into Markdown format using AI, enabling efficient extraction and conversion of URL content for LLM-friendly integration via ReviewWeb.site API.
Instructions
Convert a URL to Markdown using AI via ReviewWeb.site API. Turn a web page into LLM-friendly content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Your ReviewWebsite API key | |
| debug | No | Enable debug mode for detailed logging | |
| delayAfterLoad | No | Optional delay after page load in milliseconds | |
| model | No | AI model to use for conversion | |
| url | Yes | The URL to convert to Markdown |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"api_key": {
"description": "Your ReviewWebsite API key",
"type": "string"
},
"debug": {
"description": "Enable debug mode for detailed logging",
"type": "boolean"
},
"delayAfterLoad": {
"description": "Optional delay after page load in milliseconds",
"type": "number"
},
"model": {
"description": "AI model to use for conversion",
"type": "string"
},
"url": {
"description": "The URL to convert to Markdown",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/tools/reviewwebsite.tool.ts:49-84 (handler)MCP tool handler that processes arguments, calls the controller, and formats response for MCP protocol.async function handleConvertToMarkdown(args: ConvertToMarkdownToolArgsType) { const methodLogger = Logger.forContext( 'tools/reviewwebsite.tool.ts', 'handleConvertToMarkdown', ); methodLogger.debug(`Converting URL to Markdown with options:`, { ...args, api_key: args.api_key ? '[REDACTED]' : undefined, }); try { const result = await reviewWebsiteController.convertToMarkdown( args.url, { model: args.model, delayAfterLoad: args.delayAfterLoad, debug: args.debug, }, { api_key: args.api_key, }, ); return { content: [ { type: 'text' as const, text: result.content, }, ], }; } catch (error) { methodLogger.error(`Error converting URL to Markdown`, error); return formatErrorForMcpTool(error); } }
- src/tools/reviewwebsite.tool.ts:714-719 (registration)Registration of the 'convert_to_markdown' tool with the MCP server, including name, description, input schema, and handler.'convert_to_markdown', `Convert a URL to Markdown using AI via ReviewWeb.site API. Turn a web page into LLM-friendly content.`, ConvertToMarkdownToolArgs.shape, handleConvertToMarkdown, );
- Zod schema defining the input arguments for the convert_to_markdown tool.export const ConvertToMarkdownToolArgs = z.object({ url: z.string().describe('The URL to convert to Markdown'), model: z.string().optional().describe('AI model to use for conversion'), delayAfterLoad: z .number() .optional() .describe('Optional delay after page load in milliseconds'), debug: z .boolean() .optional() .describe('Enable debug mode for detailed logging'), api_key: z.string().optional().describe('Your ReviewWebsite API key'), });
- Controller wrapper that manages API key resolution and delegates to service layer.async function convertToMarkdown( url: string, convertOptions?: ConvertToMarkdownOptions, options: ReviewWebsiteOptions = {}, ): Promise<ControllerResponse> { const methodLogger = Logger.forContext( 'controllers/reviewwebsite.controller.ts', 'convertToMarkdown', ); methodLogger.debug('Converting URL to Markdown', { url, convertOptions }); try { const apiKey = getApiKey(options); const result = await reviewWebsiteService.convertToMarkdown( url, convertOptions, apiKey, ); return { content: JSON.stringify(result, null, 2), }; } catch (error) { return handleControllerError(error, { entityType: 'Markdown', operation: 'converting', source: 'controllers/reviewwebsite.controller.ts@convertToMarkdown', additionalInfo: { url }, }); } }
- Core service function that performs the HTTP POST request to ReviewWeb.site API endpoint /convert/markdown.async function convertToMarkdown( url: string, options?: ConvertToMarkdownOptions, apiKey?: string, ): Promise<any> { const methodLogger = Logger.forContext( 'services/vendor.reviewwebsite.service.ts', 'convertToMarkdown', ); try { methodLogger.debug('Converting URL to Markdown', { url, options }); const response = await axios.post( `${API_BASE}/convert/markdown`, { url, options, }, { headers: getHeaders(apiKey), }, ); methodLogger.debug('Successfully converted URL to Markdown'); return response.data; } catch (error) { return handleApiError(error, 'convertToMarkdown'); } }