org.llm4s.toolapi.builtin

Built-in tools for common agent operations.

This package provides production-ready tools that can be used out of the box:

== Core Utilities (No API Keys Required) ==

import org.llm4s.toolapi.builtin.core._

val tools = new ToolRegistry(Seq(
 DateTimeTool.tool,
 CalculatorTool.tool,
 UUIDTool.tool,
 JSONTool.tool
))

== File System Tools ==

import org.llm4s.toolapi.builtin.filesystem._

val fileTools = new ToolRegistry(Seq(
 ReadFileTool.create(FileConfig(
   maxFileSize = 512 * 1024,
   allowedPaths = Some(Seq("/tmp"))
 )),
 ListDirectoryTool.tool,
 FileInfoTool.tool
))

== HTTP Tools ==

import org.llm4s.toolapi.builtin.http._

val httpTools = new ToolRegistry(Seq(
 HTTPTool.create(HttpConfig(
   timeoutMs = 10000,
   allowedDomains = Some(Seq("api.example.com"))
 ))
))

== Shell Tools ==

import org.llm4s.toolapi.builtin.shell._

// Read-only shell (safe commands)
val shellTools = new ToolRegistry(Seq(
 ShellTool.create(ShellConfig.readOnly())
))

// Development shell with common dev tools
val devShellTools = new ToolRegistry(Seq(
 ShellTool.create(ShellConfig.development())
))

== Search Tools ==

import org.llm4s.toolapi.builtin.search._

val searchTools = new ToolRegistry(Seq(
 WebSearchTool.tool
))

== All Built-in Tools ==

import org.llm4s.toolapi.builtin.BuiltinTools

// Get all safe tools (no shell, restricted filesystem)
val tools = BuiltinTools.safe()

// Get all tools with custom config
val allTools = BuiltinTools.all(
 fileConfig = FileConfig(allowedPaths = Some(Seq("/tmp")))
)

Attributes

See also

Members list

Packages

Core utility tools that require no external dependencies or API keys.

Core utility tools that require no external dependencies or API keys.

These tools provide common functionality for agent workflows:

Attributes

Example
import org.llm4s.toolapi.builtin.core._
import org.llm4s.toolapi.ToolRegistry
val coreTools = new ToolRegistry(Seq(
 DateTimeTool.tool,
 CalculatorTool.tool,
 UUIDTool.tool,
 JSONTool.tool
))

File system tools for reading, writing, and managing files.

File system tools for reading, writing, and managing files.

These tools provide safe access to the file system with configurable path restrictions and size limits.

== Configuration ==

All file system tools accept FileConfig for read operations or WriteConfig for write operations. These configurations allow:

  • Path allowlists and blocklists for security
  • File size limits
  • Symbolic link handling

== Available Tools ==

Attributes

Example
import org.llm4s.toolapi.builtin.filesystem._
import org.llm4s.toolapi.ToolRegistry
// Read-only tools with default config (blocked: /etc, /var, /sys, /proc, /dev)
val readOnlyTools = new ToolRegistry(Seq(
 ReadFileTool.tool,
 ListDirectoryTool.tool,
 FileInfoTool.tool
))
// Tools with custom restrictions
val config = FileConfig(
 maxFileSize = 512 * 1024,
 allowedPaths = Some(Seq("/tmp", "/home/user/workspace"))
)
val restrictedTools = new ToolRegistry(Seq(
 ReadFileTool.create(config),
 ListDirectoryTool.create(config)
))
// Write tool with explicit allowlist
val writeConfig = WriteConfig(
 allowedPaths = Seq("/tmp/output"),
 allowOverwrite = true
)
val writeTools = new ToolRegistry(Seq(
 WriteFileTool.create(writeConfig)
))

HTTP tools for making web requests.

HTTP tools for making web requests.

These tools provide safe HTTP access with configurable domain restrictions and method limitations.

== Configuration ==

All HTTP tools accept HttpConfig for request configuration:

  • Domain allowlists and blocklists for security
  • Allowed HTTP methods
  • Response size limits
  • Timeout configuration

== Available Tools ==

  • HTTPTool: Make HTTP requests (GET, POST, PUT, DELETE, etc.)

Attributes

Example
import org.llm4s.toolapi.builtin.http._
import org.llm4s.toolapi.ToolRegistry
// Read-only HTTP tool (GET/HEAD only)
val readOnlyTool = HTTPTool.create(HttpConfig.readOnly())
// Restricted to specific domains
val restrictedTool = HTTPTool.create(HttpConfig.restricted(
 Seq("api.example.com", "data.example.org")
))
// Full access with custom timeout
val fullTool = HTTPTool.create(HttpConfig(
 timeoutMs = 60000,
 maxResponseSize = 50 * 1024 * 1024
))
val tools = new ToolRegistry(Seq(restrictedTool))

Search tools for web searches and lookups.

Search tools for web searches and lookups.

These tools provide web search capabilities using free APIs that don't require API keys.

== Available Tools ==

  • WebSearchTool: Search using DuckDuckGo Instant Answer API
  • Best for definitions, facts, quick lookups
  • No API key required
  • Returns abstracts, related topics, and infobox data

Attributes

Example
import org.llm4s.toolapi.builtin.search._
import org.llm4s.toolapi.ToolRegistry
// Default search tool
val searchTool = WebSearchTool.create()
// Custom configuration
val customSearch = WebSearchTool.create(WebSearchConfig(
 timeoutMs = 15000,
 maxResults = 5
))
val tools = new ToolRegistry(Seq(searchTool))

Shell tools for executing system commands.

Shell tools for executing system commands.

These tools provide safe shell access with configurable command allowlists and execution limits.

== Configuration ==

All shell tools require explicit command allowlisting via ShellConfig:

  • Allowed commands list (required for any execution)
  • Working directory configuration
  • Timeout limits
  • Output size limits

== Available Tools ==

  • ShellTool: Execute shell commands (requires explicit allowlist)

Attributes

Example
import org.llm4s.toolapi.builtin.shell._
import org.llm4s.toolapi.ToolRegistry
// Read-only shell (ls, cat, etc.)
val readOnlyShell = ShellTool.create(ShellConfig.readOnly())
// Development shell with common dev tools
val devShell = ShellTool.create(ShellConfig.development(
 workingDirectory = Some("/path/to/project")
))
// Custom restricted shell
val customShell = ShellTool.create(ShellConfig(
 allowedCommands = Seq("git", "npm"),
 timeoutMs = 60000
))
val tools = new ToolRegistry(Seq(devShell))

Type members

Classlikes

object BuiltinTools

Aggregator for built-in tools with convenient factory methods.

Aggregator for built-in tools with convenient factory methods.

Provides pre-configured tool sets for common use cases:

  • safe(): Core utilities, web search, and read-only HTTP (no file or shell access)
  • withFiles(): Safe tools plus read-only file system access
  • development(): All tools including shell with common dev commands

Attributes

Example
import org.llm4s.toolapi.ToolRegistry
import org.llm4s.toolapi.builtin.BuiltinTools
// Safe tools for production use
val safeRegistry = new ToolRegistry(BuiltinTools.safe())
// Development tools with file and shell access
val devRegistry = new ToolRegistry(BuiltinTools.development(
 workingDirectory = Some("/home/user/project")
))
Supertypes
class Object
trait Matchable
class Any
Self type