Skip to main content
Glama

register_agent_tool

Register a new tool for the local model to call during agent runs, supporting shell executables and JavaScript functions, with optional persistence across restarts.

Instructions

Register a NEW tool that the local model can call during run_local_agent (persists for this server session; persist=true saves it across restarts). kind='shell': an executable + argv template with ${param} placeholders (execFile, no shell). kind='js': a JS function body run in node:vm as (body)(args). Requires LOCAL_LLM_DYNAMIC_TOOLS=1 on the server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNojs kind: function source, e.g. '(args) => args.a + args.b'
kindYes
nameYesTool name, ^[a-zA-Z0-9_-]{1,64}$
commandNoshell kind: executable name/path
persistNoSave to dynamic_tools.json so it survives restarts
descriptionYesWhat it does — the local model picks tools by this text
input_schemaYesJSON Schema object for the parameters (type:'object', properties, required)
args_templateNoshell kind: argv template, e.g. ["--format", "${fmt}", "${input}"]

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.5/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so well: persistence semantics (session-only unless persist=true), execution model for both kinds (execFile with no shell; node:vm (body)(args)), and the required server env var. The 'no shell' detail is important security-relevant disclosure beyond structured data.

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

Conciseness4/5

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

Front-loaded with the core purpose, then the persistence nuance and per-kind semantics. Dense but every clause is content-bearing; no filler. Slightly packed into one paragraph rather than crisply separated.

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

Completeness4/5

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

For a complex 8-param registration tool with a nested input_schema and no output schema, the description covers persistence, both execution kinds, and the env prerequisite. It stops short of naming collision/error behavior or confirming the return, which would fully close the loop.

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 coverage is high (88%), so baseline is 3, but the description adds real meaning by explaining how kind='shell' consumes command/args_template with ${param} placeholders and how kind='js' consumes body. This ties the enum branches to their parameters in a way the terse schema descriptions do not.

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?

Starts with a specific verb+resource ('Register a NEW tool') and immediately scopes it as something the local model can call during run_local_agent. The word 'NEW' implicitly distinguishes registration from the sibling list_agent_tools/unregister_agent_tool operations, and it names run_local_agent explicitly.

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

Usage Guidelines4/5

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

Gives clear context (dynamic tools callable during run_local_agent) plus a hard prerequisite (LOCAL_LLM_DYNAMIC_TOOLS=1) and the session-vs-persistent behavior. It does not explicitly contrast with unregister_agent_tool/list_agent_tools, so when-not guidance is absent, but the usage conditions are clear.

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