Skip to main content
Glama

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

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYes
import_textYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden and does well by disclosing key behaviors: skips exact duplicates, places new imports after existing ones or at top if none exist. It doesn't mention error handling, permissions, or file system effects, but covers the core operational logic adequately.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Perfectly structured: purpose statement, behavioral details, usage guidelines with when/when-not, and concrete examples. Every sentence adds value with zero waste. The information is front-loaded with the core functionality first.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations but with an output schema (which handles return values), the description provides excellent context: clear purpose, behavioral transparency, usage guidelines, and parameter examples. It addresses what the agent needs to know to use this tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description compensates well with examples showing what 'import_text' should contain for different languages (Python, JS/TS, C/C++). It clarifies that 'import_text' is the full import statement text, not just a module name. The 'file_path' parameter meaning is implied but not explicitly explained.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Add') and resource ('import statement to a source file'), and distinguishes it from sibling 'add_import_name' by specifying it's for adding entire import statements rather than single names to existing imports. The purpose is specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly provides 'Use this when' and 'Don't use this when' guidance, naming the alternative tool 'add_import_name' for adding single names to existing multi-name imports. This gives clear context for when to choose this tool over its sibling.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kambleakash0/agent-skills'

If you have feedback or need assistance with the MCP directory API, please join our Discord server