convert_multiple_to_markdown
Transform multiple web page URLs into Markdown format using AI to create LLM-friendly content. Streamline content extraction and conversion for web pages via ReviewWebsite API.
Instructions
Convert multiple URLs to Markdown using AI via ReviewWeb.site API. Turn multiple web pages into LLM-friendly content.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Your ReviewWebsite API key | |
| debug | No | Whether to enable debug mode | |
| delayAfterLoad | No | Optional delay after page load in milliseconds | |
| maxLinks | No | Maximum number of URLs to process | |
| model | No | AI model to use for conversion | |
| urls | Yes | List of URLs to convert to Markdown |
Implementation Reference
- src/tools/reviewwebsite.tool.ts:92-129 (handler)The MCP tool handler function that executes the tool logic: extracts arguments, calls the controller method, formats the response for MCP protocol, and handles errors.async function handleConvertMultipleToMarkdown( args: ConvertMultipleToMarkdownToolArgsType, ) { const methodLogger = Logger.forContext( 'tools/reviewwebsite.tool.ts', 'handleConvertMultipleToMarkdown', ); methodLogger.debug(`Converting multiple URLs to Markdown with options:`, { ...args, api_key: args.api_key ? '[REDACTED]' : undefined, }); try { const result = await reviewWebsiteController.convertMultipleToMarkdown( args.urls, { 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 multiple URLs to Markdown`, error); return formatErrorForMcpTool(error); } }
- Zod schema defining the input arguments for the convert_multiple_to_markdown tool.export const ConvertMultipleToMarkdownToolArgs = z.object({ urls: z.array(z.string()).describe('List of URLs 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'), maxLinks: z .number() .optional() .describe('Maximum number of URLs to process'), debug: z.boolean().optional().describe('Whether to enable debug mode'), api_key: z.string().optional().describe('Your ReviewWebsite API key'), });
- src/tools/reviewwebsite.tool.ts:721-727 (registration)Registration of the MCP tool with the server, including name, description, input schema, and handler function.server.tool( 'convert_multiple_to_markdown', `Convert multiple URLs to Markdown using AI via ReviewWeb.site API. Turn multiple web pages into LLM-friendly content.`, ConvertMultipleToMarkdownToolArgs.shape, handleConvertMultipleToMarkdown, );
- Service function that makes the actual HTTP API call to ReviewWeb.site to convert multiple URLs to Markdown.async function convertMultipleToMarkdown( urls: string[], options?: ConvertToMarkdownOptions, apiKey?: string, ): Promise<any> { const methodLogger = Logger.forContext( 'services/vendor.reviewwebsite.service.ts', 'convertMultipleToMarkdown', ); try { methodLogger.debug('Converting multiple URLs to Markdown', { urls, options, }); const response = await axios.post( `${API_BASE}/convert/markdown/urls`, { urls, options, }, { headers: getHeaders(apiKey), }, ); methodLogger.debug('Successfully converted multiple URLs to Markdown'); return response.data; } catch (error) { return handleApiError(error, 'convertMultipleToMarkdown'); } }
- Controller function that orchestrates the service call, handles API key, and formats the response.async function convertMultipleToMarkdown( urls: string[], convertOptions?: ConvertToMarkdownOptions, options: ReviewWebsiteOptions = {}, ): Promise<ControllerResponse> { const methodLogger = Logger.forContext( 'controllers/reviewwebsite.controller.ts', 'convertMultipleToMarkdown', ); methodLogger.debug('Converting multiple URLs to Markdown', { urls, convertOptions, }); try { const apiKey = getApiKey(options); const result = await reviewWebsiteService.convertMultipleToMarkdown( urls, convertOptions, apiKey, ); return { content: JSON.stringify(result, null, 2), }; } catch (error) { return handleControllerError(error, { entityType: 'Markdown', operation: 'converting multiple', source: 'controllers/reviewwebsite.controller.ts@convertMultipleToMarkdown', additionalInfo: { urlCount: urls.length }, }); } }