Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
api_keyNoYour ReviewWebsite API key
urlYesURL to get after redirects

Implementation Reference

  • 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);
    	}
    }
  • 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');
    	}
    }
Install Server

Other Tools

Related Tools

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/mrgoonie/reviewwebsite-mcp-server'

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