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)Handler function that downloads JavaScript file from the given URL using axios, stores the content in Redis working memory, and returns a formatted ToolResult with success status, content details, or error message.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:11-20 (schema)Input schema definition for the 'js.download' tool, specifying a required 'url' string property.{ description: 'Download JavaScript file from URL', 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, including 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(server) which registers the 'js.download' tool among other JS tools.registerJsTools(server);