js.download
Download JavaScript files from URLs for security analysis and vulnerability testing in bug bounty hunting workflows.
Instructions
Download JavaScript file from URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL of the JS file |
Implementation Reference
- src/tools/js.ts:21-42 (handler)The handler function that implements the core logic of the 'js.download' tool. Downloads JavaScript content from the given URL using axios with a custom User-Agent, stores it in Redis working memory for 1 hour, and returns a formatted success result with content, length, and content-type, or error message on failure.async ({ url }: any): Promise<ToolResult> => { try { const response = await axios.get(url, { timeout: 30000, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', }, }); const content = response.data; await setWorkingMemory(`js:${url}`, content, 3600); return formatToolResult(true, { url, content, length: content.length, contentType: response.headers['content-type'], }); } catch (error: any) { return formatToolResult(false, null, error.message); } }
- src/tools/js.ts:13-19 (schema)Input schema defining the parameters for the js.download tool: requires a single 'url' string property describing the URL of the JS file to download.inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL of the JS file' }, }, required: ['url'], },
- src/tools/js.ts:9-43 (registration)Direct registration of the 'js.download' tool on the MCP server instance using server.tool(), providing the tool name, description, input schema, and handler function.server.tool( 'js.download', { description: 'Download JavaScript file from URL', inputSchema: { type: 'object', properties: { url: { type: 'string', description: 'URL of the JS file' }, }, required: ['url'], }, }, async ({ url }: any): Promise<ToolResult> => { try { const response = await axios.get(url, { timeout: 30000, headers: { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36', }, }); const content = response.data; await setWorkingMemory(`js:${url}`, content, 3600); return formatToolResult(true, { url, content, length: content.length, contentType: response.headers['content-type'], }); } catch (error: any) { return formatToolResult(false, null, error.message); } } );
- src/index.ts:36-36 (registration)Invocation of registerJsTools function which registers the js.download tool (among others) on the main MCP server instance during server startup.registerJsTools(server);