add_import_name
Adds a named import to an existing Python or JS/TS named-import statement, placing it in sorted order or at the end while leaving existing names unchanged.
Instructions
Add a name to an existing from <module> import ... (Python) or
import { ... } from "<module>" (JS/TS) statement; a name already
there is left as is. It goes at its sorted place when the names are
sorted (plainly or as isort and ruff sort them), else at the end, in the
list's layout: names one per line give it a line of its own, an inline
list stays inline. Refused when the file has no such import.
Use this when: the module is already imported with named imports. Don't use this when: there is no such import yet, or for a default or namespace import (add_import with the full line).
Example (from typing import Any, cast becomes Any, Dict, cast):
module="typing"
name="Dict"
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"file_path": "<file_path>",
"module": "<module>",
"name": "<name>"
},
"name": "add_import_name"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | One imported name, e.g. 'Optional'. | |
| module | Yes | Module of the import as written, without quotes (e.g. 'typing' or './utils'). | |
| file_path | Yes | Absolute path to the source or config file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |