webscraping_ai_question
Ask a question about a web page to extract specific information. Provide the URL and question, and get an answer based on the page content.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the target page. | |
| question | Yes | Question or instructions to ask the LLM model about the target page. | |
| timeout | No | Maximum web page retrieval time in ms (20000 by default, maximum is 30000). | |
| js | No | Execute on-page JavaScript using a headless browser (false by default). | |
| js_timeout | No | Maximum JavaScript rendering time in ms (3000 by default). | |
| wait_for | No | CSS selector to wait for before returning the page content. | |
| proxy | No | Type of proxy, datacenter or residential (datacenter by default). | datacenter |
| country | No | Country of the proxy to use (US by default). | |
| custom_proxy | No | Your own proxy URL in "http://user:password@host:port" format. | |
| device | No | Type of device emulation. | |
| error_on_404 | No | Return error on 404 HTTP status on the target page (false by default). | |
| error_on_redirect | No | Return error on redirect on the target page (false by default). | |
| js_script | No | Custom JavaScript code to execute on the target page. |
Implementation Reference
- src/index.js:231-246 (registration)Registration of the 'webscraping_ai_question' tool with the MCP server, including Zod schema for URL, question, and common options.
server.tool( 'webscraping_ai_question', { url: z.string().describe('URL of the target page.'), question: z.string().describe('Question or instructions to ask the LLM model about the target page.'), ...commonOptionsSchema }, async ({ url, question, ...options }) => { try { const result = await client.question(url, question, options); return createSanitizedResponse(result, url); } catch (error) { return createSanitizedResponse(error.message, url, true); } } ); - src/index.js:238-245 (handler)Handler function for the 'webscraping_ai_question' tool - calls client.question() and returns sanitized response.
async ({ url, question, ...options }) => { try { const result = await client.question(url, question, options); return createSanitizedResponse(result, url); } catch (error) { return createSanitizedResponse(error.message, url, true); } } - src/index.js:233-236 (schema)Input schema for the tool: url (string), question (string), plus common options like timeout, js, proxy, etc.
{ url: z.string().describe('URL of the target page.'), question: z.string().describe('Question or instructions to ask the LLM model about the target page.'), ...commonOptionsSchema - src/index.js:74-80 (helper)Client.question() method on WebScrapingAIClient that makes the API request to '/ai/question' endpoint.
async question(url, question, options = {}) { return this.request('/ai/question', { url, question, ...options }); } - src/index.js:216-228 (schema)Common options schema shared across all tools, used by the question tool.
const commonOptionsSchema = { timeout: z.number().optional().default(DEFAULT_TIMEOUT).describe(`Maximum web page retrieval time in ms (${DEFAULT_TIMEOUT} by default, maximum is 30000).`), js: z.boolean().optional().default(DEFAULT_JS_RENDERING).describe(`Execute on-page JavaScript using a headless browser (${DEFAULT_JS_RENDERING} by default).`), js_timeout: z.number().optional().default(DEFAULT_JS_TIMEOUT).describe(`Maximum JavaScript rendering time in ms (${DEFAULT_JS_TIMEOUT} by default).`), wait_for: z.string().optional().describe('CSS selector to wait for before returning the page content.'), proxy: z.enum(['datacenter', 'residential']).optional().default(DEFAULT_PROXY_TYPE).describe(`Type of proxy, datacenter or residential (${DEFAULT_PROXY_TYPE} by default).`), country: z.enum(['us', 'gb', 'de', 'it', 'fr', 'ca', 'es', 'ru', 'jp', 'kr', 'in']).optional().describe('Country of the proxy to use (US by default).'), custom_proxy: z.string().optional().describe('Your own proxy URL in "http://user:password@host:port" format.'), device: z.enum(['desktop', 'mobile', 'tablet']).optional().describe('Type of device emulation.'), error_on_404: z.boolean().optional().describe('Return error on 404 HTTP status on the target page (false by default).'), error_on_redirect: z.boolean().optional().describe('Return error on redirect on the target page (false by default).'), js_script: z.string().optional().describe('Custom JavaScript code to execute on the target page.') };