parse_code
Parse JavaScript/TypeScript code from a file or string, creating an AST state for analysis with other tools. Use to prepare code for review, analyze legacy scripts, or process React components.
Instructions
Parse JavaScript/TypeScript code from file or string and load it into the AST state. Must be called before using other analysis tools.
Examples: • Parse a React component: parse_code('./src/UserProfile.jsx') • Parse code string: parse_code('function hello() { return "world"; }') • Parse with explicit language: parse_code('./config.js', language='javascript') • Analyze legacy code: parse_code('./old-script.js') then use other tools to understand structure • Code review prep: parse_code('./feature.ts') then get_functions() to review all functions
Input Schema
Name | Required | Description | Default |
---|---|---|---|
isFilePath | No | Whether source is a file path (true) or code string (false). Defaults to auto-detect. | |
language | No | Language to use (javascript, typescript, jsx, tsx). Auto-detected if not provided. | |
source | Yes | File path (./src/app.js) or code string ('const x = 1;') |