url_get_after_redirects
Resolve the final URL after all redirects using the ReviewWebsite API. Input a URL to retrieve its destination, ensuring accurate web content analysis and verification.
Instructions
Get URL after redirects using ReviewWeb.site API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| api_key | No | Your ReviewWebsite API key | |
| url | Yes | URL to get after redirects |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"api_key": {
"description": "Your ReviewWebsite API key",
"type": "string"
},
"url": {
"description": "URL to get after redirects",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/tools/reviewwebsite.tool.ts:504-536 (handler)MCP tool handler function that receives tool arguments, calls the controller to resolve the URL after redirects, formats the MCP response, and handles errors.async function handleGetUrlAfterRedirects( args: UrlGetUrlAfterRedirectsToolArgsType, ) { const methodLogger = Logger.forContext( 'tools/reviewwebsite.tool.ts', 'handleGetUrlAfterRedirects', ); methodLogger.debug(`Getting URL after redirects:`, { ...args, api_key: args.api_key ? '[REDACTED]' : undefined, }); try { const result = await reviewWebsiteController.getUrlAfterRedirects( args.url, { api_key: args.api_key, }, ); return { content: [ { type: 'text' as const, text: result.content, }, ], }; } catch (error) { methodLogger.error(`Error getting URL after redirects`, error); return formatErrorForMcpTool(error); } }
- src/tools/reviewwebsite.tool.ts:789-794 (registration)Registration of the MCP tool 'url_get_after_redirects' with the server, including name, description, input schema shape, and handler reference.server.tool( 'url_get_after_redirects', `Get URL after redirects using ReviewWeb.site API.`, UrlGetUrlAfterRedirectsToolArgs.shape, handleGetUrlAfterRedirects, );
- Zod schema defining the tool's input parameters: required 'url' string and optional 'api_key' string.export const UrlGetUrlAfterRedirectsToolArgs = z.object({ url: z.string().describe('URL to get after redirects'), api_key: z.string().optional().describe('Your ReviewWebsite API key'), });
- Core service function that makes the HTTP GET request to the ReviewWebsite API endpoint to retrieve the final URL after following redirects.async function getUrlAfterRedirects( url: string, apiKey?: string, ): Promise<any> { const methodLogger = Logger.forContext( 'services/vendor.reviewwebsite.service.ts', 'getUrlAfterRedirects', ); try { methodLogger.debug('Getting URL after redirects', { url }); // Build query parameters const params = new URLSearchParams(); params.append('url', url); const response = await axios.get( `${API_BASE}/url/get-url-after-redirects`, { params, headers: getHeaders(apiKey), }, ); methodLogger.debug('Successfully got URL after redirects'); return response.data; } catch (error) { return handleApiError(error, 'getUrlAfterRedirects'); } }