url_decode
Decode URL-encoded strings to restore original text, useful for processing web data and debugging encoded URLs.
Instructions
Decode a URL-encoded string.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | The URL-encoded string to decode |
Implementation Reference
- src/tools/encoding.ts:51-74 (handler)The implementation and registration of the "url_decode" tool using `server.tool`. The handler uses `decodeURIComponent` to perform the decoding and includes error handling.
server.tool( "url_decode", "Decode a URL-encoded string.", { input: z.string().describe("The URL-encoded string to decode") }, async ({ input }) => { try { return { content: [ { type: "text" as const, text: decodeURIComponent(input) }, ], }; } catch { return { content: [ { type: "text" as const, text: "Error: Invalid URL-encoded input", }, ], isError: true, }; } } );