Skip to main content

Overview

ADK-TS includes a comprehensive library of pre-built tools organized into three categories:
  • Default Tools - File operations, web access, and shell execution
  • Common Tools - HTTP requests, user interaction, memory, and agent delegation
  • Memory Tools - Advanced memory management operations

Default Tools

These tools provide fundamental file system and web operations.

ReadTool

Read file contents from the filesystem.
import { ReadTool } from '@iqai/adk';

const readTool = new ReadTool();

// The agent can use this to read files
const agent = new AgentBuilder()
  .withTools([readTool])
  .buildLlm();
filePath
string
required
Path to the file to read
offset
number
Line number to start reading from (0-based)
limit
number
Number of lines to read

WriteTool

Write content to files.
import { WriteTool } from '@iqai/adk';

const writeTool = new WriteTool();
filePath
string
required
Path to the file to write
content
string
required
Content to write to the file

EditTool

Edit existing files with search and replace.
import { EditTool } from '@iqai/adk';

const editTool = new EditTool();
filePath
string
required
Path to the file to edit
oldString
string
required
Text to search for
newString
string
required
Text to replace with
replaceAll
boolean
Replace all occurrences (default: false)

GlobTool

Search for files matching patterns.
import { GlobTool } from '@iqai/adk';

const globTool = new GlobTool();
pattern
string
required
Glob pattern (e.g., ”/*.ts”, “src//*.js”)
path
string
Directory to search in (defaults to current directory)

GrepTool

Search file contents using regex patterns.
import { GrepTool } from '@iqai/adk';

const grepTool = new GrepTool();
pattern
string
required
Regex pattern to search for
path
string
Directory to search in
include
string
File pattern to include (e.g., “.js”, ”.”)

BashTool

Execute terminal commands with security restrictions.
Security Critical: BashTool is disabled by default. Only enable in trusted, sandboxed environments.
import { BashTool } from '@iqai/adk';

// Whitelist mode (recommended)
const bashTool = new BashTool({
  enabled: true,
  mode: 'whitelist',
  allowedCommands: ['ls', 'pwd', 'echo', 'cat', 'grep'],
  maxTimeout: 30000
});

// Sandboxed mode (Docker required)
const sandboxedBash = new BashTool({
  enabled: true,
  mode: 'sandboxed',
  dockerImage: 'alpine:latest',
  maxTimeout: 30000
});

// Unrestricted mode (DANGEROUS - dev only)
const unrestrictedBash = new BashTool({
  enabled: true,
  mode: 'unrestricted',  // Not recommended
  maxTimeout: 30000
});
Configuration Options:
enabled
boolean
required
Must be explicitly set to true
mode
string
required
Security mode: whitelist, sandboxed, or unrestricted
allowedCommands
string[]
Commands allowed in whitelist mode (defaults to safe commands)
dockerImage
string
Docker image for sandboxed mode (default: alpine:latest)
maxTimeout
number
Command timeout in milliseconds (default: 30000)

WebFetchTool

Fetch content from web URLs.
import { WebFetchTool } from '@iqai/adk';

const webFetchTool = new WebFetchTool();
url
string
required
URL to fetch

WebSearchTool

Perform web searches using Google.
import { WebSearchTool } from '@iqai/adk';

const webSearchTool = new WebSearchTool({
  apiKey: process.env.GOOGLE_API_KEY!,
  searchEngineId: process.env.GOOGLE_SEARCH_ENGINE_ID!
});
query
string
required
Search query
numResults
number
Number of results to return (default: 10)

Common Tools

Tools for HTTP requests, user interaction, and system operations.

HttpRequestTool

Make HTTP requests to external APIs.
import { HttpRequestTool } from '@iqai/adk';

const httpTool = new HttpRequestTool();
Parameters:
url
string
required
URL to send the request to
method
string
HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, OPTIONS (default: GET)
headers
object
Request headers
body
string
Request body (typically JSON string)
params
object
URL query parameters
timeout
number
Request timeout in milliseconds (default: 10000)
Example:
// Agent can make API calls
const response = await agent.ask(
  'Get the latest Bitcoin price from https://api.example.com/btc/price'
);

FileOperationsTool

Comprehensive file system operations.
import { FileOperationsTool } from '@iqai/adk';

const fileOpsTool = new FileOperationsTool({
  basePath: process.cwd()  // Restrict operations to this directory
});
Parameters:
operation
string
required
Operation: read, write, append, delete, exists, list, mkdir
filepath
string
required
Path to file or directory
content
string
Content for write/append operations
encoding
string
File encoding (default: utf8)
Example:
// Agent can perform various file operations
const agent = new AgentBuilder()
  .withTools([fileOpsTool])
  .buildLlm();

await agent.ask('List all files in the current directory');
await agent.ask('Create a new directory called "output"');
await agent.ask('Write "Hello World" to output/test.txt');

UserInteractionTool

Prompt users for input during agent execution.
import { UserInteractionTool } from '@iqai/adk';

const userTool = new UserInteractionTool();
message
string
required
Message to display to the user
type
string
Input type: text, confirmation, choice

GetUserChoiceTool

Present multiple choice options to users.
import { GetUserChoiceTool } from '@iqai/adk';

const choiceTool = new GetUserChoiceTool();
message
string
required
Question to ask the user
choices
string[]
required
Available options

GoogleSearchTool

Google search with grounding (requires Google AI).
import { GoogleSearchTool } from '@iqai/adk';

const googleSearch = new GoogleSearchTool();

RecallMemoryTool

Recall information from conversation memory.
import { RecallMemoryTool } from '@iqai/adk';

const recallTool = new RecallMemoryTool();
query
string
required
Search query for memory recall

PreloadMemoryTool

Preload memory context at the start of a conversation.
import { PreloadMemoryTool } from '@iqai/adk';

const preloadTool = new PreloadMemoryTool();

LoadArtifactsTool

Load files attached to the session.
import { LoadArtifactsTool } from '@iqai/adk';

const artifactsTool = new LoadArtifactsTool();
filename
string
required
Name of the artifact to load

AgentTool

Delegate tasks to other agents.
import { AgentTool } from '@iqai/adk';

const specialistAgent = new AgentBuilder()
  .withName('specialist')
  .withModel('gpt-4')
  .buildLlm();

const agentTool = new AgentTool({
  agent: specialistAgent,
  name: 'consult_specialist',
  description: 'Consult a specialist agent for complex queries'
});

TransferToAgentTool

Transfer conversation control to another agent.
import { TransferToAgentTool } from '@iqai/adk';

const transferTool = new TransferToAgentTool({
  targetAgent: specialistAgent,
  transferMessage: 'Transferring to specialist...'
});

ExitLoopTool

Exit from loop agent iterations.
import { ExitLoopTool } from '@iqai/adk';

const exitTool = new ExitLoopTool();

Memory Tools

Advanced memory management for agents.

WriteMemoryTool

Store information in long-term memory.
import { WriteMemoryTool } from '@iqai/adk';

const writeMemoryTool = new WriteMemoryTool();
content
string
required
Content to store in memory
metadata
object
Additional metadata for the memory entry

ForgetMemoryTool

Remove information from memory.
import { ForgetMemoryTool } from '@iqai/adk';

const forgetTool = new ForgetMemoryTool();
query
string
required
Query to identify memories to forget

GetSessionDetailsTool

Retrieve current session information.
import { GetSessionDetailsTool } from '@iqai/adk';

const sessionTool = new GetSessionDetailsTool();
Returns:
  • Session ID
  • User ID
  • App name
  • Creation time
  • Last activity
  • Session metadata

Using Multiple Tools

Combine tools for powerful agent capabilities:
import {
  AgentBuilder,
  ReadTool,
  WriteTool,
  EditTool,
  HttpRequestTool,
  RecallMemoryTool,
  WriteMemoryTool
} from '@iqai/adk';

const agent = new AgentBuilder()
  .withName('multi_tool_agent')
  .withModel('gpt-4')
  .withTools([
    // File operations
    new ReadTool(),
    new WriteTool(),
    new EditTool(),
    
    // HTTP requests
    new HttpRequestTool(),
    
    // Memory management
    new RecallMemoryTool(),
    new WriteMemoryTool()
  ])
  .withInstruction(`
    You are a helpful assistant with access to file operations,
    HTTP requests, and memory management. Use tools as needed to
    accomplish user requests.
  `)
  .buildLlm();

const response = await agent.ask(
  'Read package.json, fetch latest version from npm API, and update the version field'
);

Tool Security Considerations

Always validate tool inputs and restrict file system access to trusted directories.

File System Tools

  • Use basePath option in FileOperationsTool to restrict access
  • Never expose tools with unrestricted file system access to untrusted users
  • Validate file paths to prevent directory traversal attacks

Bash Tool

  • Never use unrestricted mode in production
  • Prefer whitelist mode with minimal command set
  • Use sandboxed mode for untrusted operations (requires Docker)
  • Set appropriate timeouts to prevent resource exhaustion

HTTP Tools

  • Validate URLs before making requests
  • Set reasonable timeouts
  • Be cautious with user-provided URLs
  • Consider rate limiting for external API calls

Next Steps

Creating Tools

Learn how to create custom tools

MCP Integration

Connect to external MCP servers

Build docs developers (and LLMs) love