Skip to Content

Interface Tool

One memory operation, ready to hand to an agent framework.

The four fields are the whole handover: Tool.name and Tool.description tell a model what this is, Tool.parameters tells it what to send, and Tool.call runs it and returns text to hand straight back as the tool result — no rendering left to do.

Tool.call throws every failure except the two in AGENT_RECOVERABLE, a malformed request and a handle that resolves to nothing, which come back as text for the model to act on. So a rejected credential, a timeout, an unreachable service or a spent quota reaches your code as an exception rather than reaching the model as a suggestion to try again.

Reach for these individually when wiring a framework by hand; Toolset already does it for the frameworks it names.

for (const tool of session.tools()) {
console.log(tool.name, tool.description, tool.parameters.required)
}
interface Tool {
    name: string;
    description: string;
    parameters: ToolParameters;
    call(args: Record<string, unknown>): Promise<string>;
}
Index
name: string

The name a model calls, such as memco_search.

description: string

What the operation is for, as a model should read it.

parameters: ToolParameters

A JSON Schema object describing the arguments, with a description on each.

Built fresh per Session.tools call, so a framework that normalises schemas in place cannot reach through and corrupt another tool's.

  • Run the operation and render the result as text.

    Parameters

    • args: Record<string, unknown>

      The arguments the schema describes. Untrusted.

    Returns Promise<string>

    The result as text, or what the model got wrong.