WorkspaceTools

org.llm4s.toolapi.WorkspaceTools

Factory object for creating workspace tools with consistent schemas and handlers. This eliminates duplication across different use cases while allowing customization of handler behavior and return types.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

Creates a complete set of workspace tools using default handlers. This is equivalent to the original createWorkspaceTools method but using the factory methods.

Creates a complete set of workspace tools using default handlers. This is equivalent to the original createWorkspaceTools method but using the factory methods.

Attributes

def createExecuteTool[T : ReadWriter](workspace: ContainerisedWorkspace, includeWorkingDir: Boolean, includeTimeout: Boolean)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create an execute command tool that runs shell commands.

Create an execute command tool that runs shell commands.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

includeTimeout

Whether to include timeout parameter

includeWorkingDir

Whether to include working_directory parameter

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def createExploreTool[T : ReadWriter](workspace: ContainerisedWorkspace, includeRecursive: Boolean)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create an explore files tool that lists files and directories.

Create an explore files tool that lists files and directories.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

includeRecursive

Whether to include recursive parameter in schema

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def createModifyTool[T : ReadWriter](workspace: ContainerisedWorkspace)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create a modify file tool that performs operations like replace, insert, or delete.

Create a modify file tool that performs operations like replace, insert, or delete.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def createReadTool[T : ReadWriter](workspace: ContainerisedWorkspace, includeLineParams: Boolean)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create a read file tool that reads file contents.

Create a read file tool that reads file contents.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

includeLineParams

Whether to include start_line and end_line parameters

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def createSearchTool[T : ReadWriter](workspace: ContainerisedWorkspace, includeSearchType: Boolean, includeRecursive: Boolean)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create a search files tool that searches for content in files.

Create a search files tool that searches for content in files.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

includeRecursive

Whether to include recursive parameter

includeSearchType

Whether to include search_type parameter

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def createWriteTool[T : ReadWriter](workspace: ContainerisedWorkspace, includeCreateDirs: Boolean)(handler: (SafeParameterExtractor, ContainerisedWorkspace) => Either[String, T]): Result[ToolFunction[Map[String, Any], T]]

Create a write file tool that writes content to files.

Create a write file tool that writes content to files.

Type parameters

T

Return type of the handler

Value parameters

handler

Custom handler function for parameter extraction and result transformation

includeCreateDirs

Whether to include create_directories parameter

workspace

The workspace to operate on

Attributes

Returns

A configured ToolFunction

def defaultExecuteHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for execute tool that returns ujson.Value

Default handler for execute tool that returns ujson.Value

Attributes

def defaultExploreHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for explore tool that returns ujson.Value

Default handler for explore tool that returns ujson.Value

Attributes

def defaultModifyHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for modify tool that returns ujson.Value

Default handler for modify tool that returns ujson.Value

Attributes

def defaultReadHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for read tool that returns ujson.Value

Default handler for read tool that returns ujson.Value

Attributes

def defaultSearchHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for search tool that returns ujson.Value

Default handler for search tool that returns ujson.Value

Attributes

def defaultWriteHandler(params: SafeParameterExtractor, workspace: ContainerisedWorkspace): Either[String, Value]

Default handler for write tool that returns ujson.Value

Default handler for write tool that returns ujson.Value

Attributes