Tools

Tools are the actions ScalyClaw can take during a conversation. The LLM decides when and how to use them — it emits a structured tool call, the system executes it, and the result is fed back into the conversation before the LLM continues. This loop repeats until the LLM produces a final text response with no pending tool calls.

ScalyClaw ships with a large set of built-in tools covering code execution, memory, messaging, scheduling, agent management, file I/O, vault, configuration, and more. They are always available — no additional configuration required. MCP tools from connected servers are discovered automatically and work the same way.

Built-in Tools

Built-in tools are divided into two categories by how they execute: direct tools run inline on the Node process, and job tools are dispatched to a BullMQ worker queue. See the Tool Architecture section for the full routing table.

Direct Tools

Direct tools run synchronously in the Node process. They are fast, lightweight operations — SQLite queries, Redis reads/writes, in-memory lookups — where the overhead of a queue round-trip would be net negative.

Memory

ToolDescriptionKey Parameters
memory_store Persist a fact, preference, or observation to the long-term memory system. The entry is embedded and indexed for future semantic retrieval. content — text to remember
type — category label (e.g. "preference", "fact", "task")
confidence — float 0–1
memory_search Query existing memories using semantic similarity. Returns the most relevant entries ranked by vector distance, with FTS5 full-text search as a fallback. query — natural-language search string
limit — maximum results (default 10)
memory_recall Retrieve a specific memory entry by its ID. id — numeric ID of the memory entry
memory_update Update the content or metadata of an existing memory entry. id — numeric ID of the memory entry
content — updated text
type — updated category
confidence — updated confidence
memory_delete Remove a specific memory entry by its ID. Use when a stored fact is outdated or incorrect. id — numeric ID of the memory entry to delete

Messaging

ToolDescriptionKey Parameters
send_message Send a text message to a channel or user. channel — target channel ID
message — text content to send
send_file Send a file to a channel or user. channel — target channel ID
path — path to the file to send
caption — optional description

Agents

ToolDescriptionKey Parameters
list_agents List all configured agents and their current state.
create_agent Create a new agent with a given name, system prompt, and configuration. name — unique agent name
prompt — system prompt text
models, tools, skills — optional initial config
update_agent Update the configuration of an existing agent. name — agent to update
prompt, models, etc. — fields to change
delete_agent Permanently delete an agent by name. name — agent to delete
toggle_agent Enable or disable an agent without deleting it. name — agent name
enabled — boolean
set_agent_models Set the list of models an agent is allowed to use. name — agent name
models — array of model IDs
set_agent_skills Set the skills available to an agent. name — agent name
skills — array of skill names
set_agent_tools Set the tools available to an agent. name — agent name
tools — array of tool names
set_agent_mcps Set the MCP server connections available to an agent. name — agent name
mcps — array of MCP server names

Scheduling

ToolDescriptionKey Parameters
list_reminders List all scheduled reminders for the current channel.
list_tasks List all scheduled LLM tasks.
cancel_reminder Cancel a previously scheduled reminder, removing its BullMQ job from the scheduler queue. id — reminder ID returned when it was created
cancel_task Cancel a previously scheduled LLM task. id — task ID returned when it was created

Vault

ToolDescriptionKey Parameters
vault_store Store a secret in the vault. Secrets are stored encrypted in Redis at scalyclaw:secret:*. key — secret name
value — secret value
vault_check Check whether a secret with the given key exists in the vault (does not reveal the value). key — secret name to check
vault_delete Remove a secret from the vault by key. key — secret name to delete
vault_list List all secret keys currently stored in the vault (keys only, not values).

Models

ToolDescriptionKey Parameters
list_models List all available LLM models and their enabled state.
toggle_model Enable or disable a specific LLM model. model — model ID
enabled — boolean

Skills

ToolDescriptionKey Parameters
list_skills List all deployed skills and their enabled state.
toggle_skill Enable or disable a specific skill. skill — skill name
enabled — boolean

Guards

ToolDescriptionKey Parameters
list_guards List all guard prompts and their enabled state.
toggle_guard Enable or disable a specific guard prompt. guard — guard name
enabled — boolean

Configuration

ToolDescriptionKey Parameters
get_config Read the current system configuration stored in Redis at scalyclaw:config.
update_config Update one or more configuration keys. changes — object with key/value pairs to update

Usage

ToolDescriptionKey Parameters
get_usage Retrieve token usage and cost statistics.

Queue and Process Management

ToolDescriptionKey Parameters
list_processes List running system processes.
list_queues List all BullMQ queues and their current state (active, waiting, completed, failed counts).
list_jobs List jobs in a given queue, optionally filtered by state. queue — queue name
state — optional filter (e.g. "active", "failed")
pause_queue Pause a BullMQ queue so no new jobs are picked up by workers. queue — queue name to pause
resume_queue Resume a previously paused BullMQ queue. queue — queue name to resume
clean_queue Remove completed or failed jobs from a queue up to a given age. queue — queue name
grace — minimum job age in ms
state — job state to clean

File I/O

ToolDescriptionKey Parameters
read_file Read the full contents of a file from disk. path — absolute file path
read_file_lines Read a specific range of lines from a file. path — absolute file path
start — starting line number
end — ending line number
write_file Write (or overwrite) a file with the given content. path — absolute file path
content — text to write
patch_file Apply a targeted text replacement inside a file without rewriting the whole thing. path — absolute file path
old — exact string to find
new — replacement string
append_file Append content to the end of a file. path — absolute file path
content — text to append
diff_files Compute a unified diff between two files. path_a — first file path
path_b — second file path
file_info Return metadata about a file (size, modification time, permissions). path — absolute file path
copy_file Copy a file from one path to another. src — source path
dest — destination path
copy_folder Recursively copy a folder from one path to another. src — source folder path
dest — destination folder path

Context

ToolDescriptionKey Parameters
compact_context Summarise and compress the current conversation context to reduce token consumption.

Job Tools

Job tools are dispatched to BullMQ worker queues. The Node process enqueues a job and awaits the result asynchronously. This provides process isolation for arbitrary code execution, a separate concurrency domain for agent delegation, and the ability to scale workers independently.

ToolDescriptionQueueKey Parameters
execute_command Run a shell or subprocess command on the worker. scalyclaw-tools command — command string to execute
cwd — optional working directory
execute_skill Invoke a deployed skill by name. Skills are reusable TypeScript/JavaScript modules stored in Redis and executed on the worker. scalyclaw-tools skill — name of the skill to invoke
parameters — arbitrary object passed as input to the skill
execute_code Execute code in a sandboxed worker process. Supports JavaScript, Python, and Bash. Returns stdout, stderr, and exit code. scalyclaw-tools language"js" | "python" | "bash"
code — source string to execute
delegate_agent Hand off a task to a named sub-agent. The sub-agent runs its own orchestrator loop with its own system prompt and tool set, then returns a structured result. scalyclaw-agents agent — name of the agent to delegate to
task — natural-language description of the work to perform
schedule_reminder Schedule a one-shot text reminder. The message is delivered back to the channel at the specified time. scalyclaw-scheduler message — content of the reminder
at — ISO 8601 timestamp
timezone — IANA timezone string
schedule_recurrent_reminder Schedule a repeating reminder on a cron schedule. scalyclaw-scheduler message — content of the reminder
cron — cron expression
timezone — IANA timezone string
schedule_task Schedule a one-shot LLM task to run at a future time. scalyclaw-scheduler task — natural-language task description
at — ISO 8601 timestamp
schedule_recurrent_task Schedule a repeating LLM task on a cron schedule. scalyclaw-scheduler task — natural-language task description
cron — cron expression
timezone — IANA timezone string

Meta Tools (Job Management)

Meta tools let the LLM inspect and manage the jobs it has submitted, enabling patterns like fire-and-forget parallelism with later result collection.

ToolDescriptionKey Parameters
submit_job Submit a single job to a queue and return its job ID immediately without waiting for completion. queue — target queue
data — job payload
submit_parallel_jobs Submit multiple jobs to a queue in parallel and return all job IDs. queue — target queue
jobs — array of job payloads
get_job Poll the status and result of a previously submitted job by ID. queue — queue the job belongs to
id — job ID
list_active_jobs List all jobs currently in progress across queues.

Tool Call Example

When the LLM decides to use a tool, it emits a structured JSON object. ScalyClaw parses this, routes it to the correct execution target, and returns the result in the next turn.

json
// memory_store — persist a user preference
{
  "type": "tool_use",
  "id": "toolu_01XqR9",
  "name": "memory_store",
  "input": {
    "content": "User prefers responses in British English",
    "type": "preference",
    "confidence": 0.95
  }
}
json
// execute_code — run a quick calculation
{
  "type": "tool_use",
  "id": "toolu_02Yp7K",
  "name": "execute_code",
  "input": {
    "language": "js",
    "code": "const result = [1,2,3,4,5].reduce((a,b) => a+b, 0);\nconsole.log(result);"
  }
}
json
// schedule_recurrent_reminder — recurring daily reminder
{
  "type": "tool_use",
  "id": "toolu_03Zc1M",
  "name": "schedule_recurrent_reminder",
  "input": {
    "message": "Time to review your open tasks",
    "cron": "0 9 * * 1-5",
    "timezone": "Europe/London"
  }
}

MCP Tools

ScalyClaw supports the Model Context Protocol (MCP). Tools discovered from connected MCP servers are automatically added to the available tools list at startup and whenever a hot-reload signal is received. They appear alongside built-in tools with no special configuration required beyond registering the MCP server connection.

The LLM uses MCP tools exactly the same way it uses built-in tools — by name, with a structured input object. ScalyClaw handles schema discovery, input validation, and result forwarding transparently.

AspectBuilt-in ToolsMCP Tools
Registration Hardcoded in tool-impl.ts Discovered from MCP server at connection time
Schema Defined in source code Provided by the MCP server via tools/list
Execution target Local or worker queue (see routing table below) Forwarded to the MCP server; runs in the server process
Hot reload Not applicable Re-discovered on scalyclaw:skills:reload pub/sub signal
LLM visibility Always present in system prompt tool list Injected into system prompt alongside built-in tools
Tip

MCP servers are registered in the ScalyClaw dashboard under Settings → MCP Servers. Each entry takes a transport type (stdio or sse), a command or URL, and optional environment variables that are resolved from the secret vault.

Tool Architecture

Not all tools need the same execution environment. The unified tool router in tool-impl.ts uses a TOOL_QUEUE map to decide where each tool runs before dispatching it. This keeps the routing logic in one place and makes it easy to add new tools without changing the orchestrator.

Routing Table

ToolExecution targetQueue (TOOL_QUEUE key)Reason
execute_code Worker sandbox toolsscalyclaw-tools Arbitrary code must run in an isolated process, not in the Node
execute_skill Worker skill runner toolsscalyclaw-tools Skills are loaded and executed in the worker; worker holds the module cache
execute_command Worker subprocess toolsscalyclaw-tools Shell commands run in an isolated worker process for safety
delegate_agent Node agent executor agentsscalyclaw-agents Sub-agents run their own orchestrator loop; separate queue for independent scaling
schedule_reminder Node — inline schedulerscalyclaw-scheduler Enqueues a BullMQ delayed job; the enqueue itself is fast and synchronous
schedule_recurrent_reminder Node — inline schedulerscalyclaw-scheduler Enqueues a repeating BullMQ job
schedule_task Node — inline schedulerscalyclaw-scheduler Enqueues a one-shot LLM task job
schedule_recurrent_task Node — inline schedulerscalyclaw-scheduler Enqueues a repeating LLM task job
All other built-in tools Node — inline — (no queue) Lightweight operations (SQLite, Redis, filesystem); no isolation or offloading needed
MCP tools Worker → MCP server toolsscalyclaw-tools Forwarded to the MCP server process; worker holds the MCP client connections

Simplified Routing Logic

typescript
// tool-impl.ts — TOOL_QUEUE map (simplified)
const TOOL_QUEUE: Map<string, "tools" | "agents" | null> = new Map([
  ["execute_command",            "tools"],    // → scalyclaw-tools (sandboxed worker)
  ["execute_skill",              "tools"],    // → scalyclaw-tools (skill runner)
  ["execute_code",               "tools"],    // → scalyclaw-tools (sandboxed worker)
  ["delegate_agent",             "agents"],   // → scalyclaw-agents (agent executor)
  // everything else → null → local executeTool()
]);

async function routeTool(call: ToolCall): Promise<ToolResult> {
  const queue = TOOL_QUEUE.get(call.name);

  if (queue === "tools") {
    return dispatchToQueue("tools", call);    // await BullMQ job result
  }
  if (queue === "agents") {
    return dispatchToQueue("agents", call);   // await BullMQ job result
  }
  // null → run inline in the Node process
  return executeTool(call);
}

Why the Split?

The split between worker-queued and locally-executed tools reflects two different concerns:

  • Isolation and safetyexecute_code and execute_command run arbitrary user-provided code and shell commands. Executing them inside the Node process could crash the orchestrator or expose internal state. The worker process provides a hard process boundary. If execution goes wrong, only the worker job fails — the Node is unaffected.
  • Module loading — Skills are TypeScript/JavaScript modules loaded dynamically from Redis. The worker maintains the module cache so reloads are fast and the Node's runtime stays clean.
  • Independent scaling — By routing code execution and agent delegation to separate queues, you can run more workers in high-throughput scenarios without touching the Node. Memory and scheduler operations are fast enough that the overhead of a queue round-trip would be net negative.
  • Latency — Memory reads, memory writes, and vault lookups each complete in under 5 ms against a local SQLite database or Redis connection. Queueing them would add 10–50 ms of unnecessary overhead per tool call.
MCP tools and the tools queue

MCP tools discovered from connected MCP servers are also routed through the tools BullMQ queue (scalyclaw-tools). The worker holds the MCP client connections, so all communication with MCP servers — including tools/call requests — is handled by the worker, not the Node. The Node simply enqueues the call and awaits the result, the same way it does for execute_code and execute_skill.

Agent Tool Scoping

Sub-agents have a restricted tool set compared to the main orchestrator. This prevents runaway recursion (agents cannot delegate further), limits scheduling access to the main channel, and keeps sub-agent scope focused on the task at hand.

CategoryAvailable to agents
Messaging send_message, send_file
Memory memory_store, memory_search, memory_recall, memory_update, memory_delete
Vault vault_check, vault_list (read-only access; no store or delete)
File I/O All file I/O tools (read_file, write_file, patch_file, etc.)
Code / Skills / Commands execute_code, execute_skill, execute_command
Agent delegation Not available — agents cannot delegate to other agents
Scheduling Not available — agents cannot create or cancel reminders or tasks