add_import
Add import statements to source files without duplicates. Places imports after existing ones or at file start. Use when a file needs new imports not already referenced.
Instructions
Add an import statement to a source file. Skips exact duplicates. Places new imports after existing ones, or at the top of the file if none exist.
Use this when: You need to import something the file does not already reference.
Don't use this when: You're adding a single name to an existing multi-name
import statement like from X import a, b -> use add_import_name.
Example: import_text="from typing import Optional" # Python import_text="import { readFile } from 'fs';" # JS/TS import_text="#include <stdlib.h>" # C/C++
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | ||
| import_text | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |