unshorten_url
Expand shortened URLs to reveal the original destination for security verification and OSINT research.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Shortened URL to expand |
Implementation Reference
- src/tools/network-adv.ts:23-35 (handler)The handler method in NetworkAdvClient that performs the actual unshortening by fetching the URL with manual redirect following.
async unshorten(url: string): Promise<any> { try { const response = await fetch(url, { redirect: 'manual', method: 'HEAD' }); const location = response.headers.get('location'); return { shortUrl: url, destination: location || url, isRedirect: !!location, status: response.status }; } catch (error) { throw new McpError(ErrorCode.InternalError, `Unshorten error: ${(error as Error).message}`); } - src/index.ts:686-694 (registration)Registration of the 'unshorten_url' tool, which validates input using Zod and calls the netAdvClient.unshorten handler.
server.tool( "unshorten_url", { url: z.string().url().describe("Shortened URL to expand") }, async ({ url }) => { const result = await netAdvClient.unshorten(url); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }