Development
Extract all import/require paths from JavaScript/TypeScript code
Call this tool from your code in three languages.
curl -X POST 'https://api.elysiatools.com/en/api/tools/import-path-extractor' \
-H 'Content-Type: application/json' \
-d '{"code":"Paste your JavaScript or TypeScript code here to extract imports...","includeNodeModules":true,"includeRelativePaths":true,"groupByType":true}'Send a POST request with your inputs as JSON. File parameters require a separate upload first.
POST https://api.elysiatools.com/en/api/tools/import-path-extractor| Name | Type | Required | Description |
|---|---|---|---|
| code | textarea | Yes | — |
| includeNodeModules | checkbox | No | Include imports from node_modules (package imports) |
| includeRelativePaths | checkbox | No | Include relative file imports (./, ../) |
| groupByType | checkbox | No | Group results by import type (ES6, CommonJS, Dynamic, etc.) |
JSON result
{
"key": {...},
"metadata": {
"key": "value"
},
"error": "Error message (optional)",
"message": "Notification message (optional)"
}Add this tool to your Model Context Protocol server so AI agents can list and call it.
Add this block to your MCP client configuration:
{
"mcpServers": {
"elysiatools-import-path-extractor": {
"name": "import-path-extractor",
"description": "Extract all import/require paths from JavaScript/TypeScript code",
"baseUrl": "https://api.elysiatools.com/mcp/sse?toolId=import-path-extractor",
"command": "",
"args": [],
"env": {},
"isActive": true,
"type": "sse"
}
}
}After connecting to the SSE endpoint, list the exposed tools:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}Invoke the tool by its id, passing arguments built from its parameters:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "import-path-extractor",
"arguments": {
"code": "Paste your JavaScript or TypeScript code here to extract imports...",
"includeNodeModules": true,
"includeRelativePaths": true,
"groupByType": true
}
}
}Questions or issues? Contact [email protected]