Documentation/Tools & Function Calling
v2.0.0-beta.1Snapshot bebdcd1Markdown ↗

Tools & Function Calling

Tools & Function Calling

Define and execute tools for agents

AgentPackageToolServer class

📍 src/portable/AgentPackage.ts:425

Session-bound server executor for tools exported as remote. The host must authenticate and authorize every request before calling execute().

Constructor

constructor

typescript
constructor(
    private readonly agent: Agent,
    private readonly packageValue: SerializedAgentPackage,
  )

Parameters:

  • agent: Agent
  • packageValue: SerializedAgentPackage
Methods

start()

typescript
async start(): Promise<void>

Returns: Promise<void>

execute()

typescript
async execute(input: unknown): Promise<RemoteToolExecutionResponse>

Parameters:

  • input: unknown

Returns: Promise<RemoteToolExecutionResponse>

close()

typescript
close(status: 'completed' | 'failed' | 'cancelled' = 'completed'): Promise<void>

Parameters:

  • status: "completed" | "failed" | "cancelled" (optional) (default: 'completed')

Returns: Promise<void>


ConnectorTools class

📍 src/tools/connector/ConnectorTools.ts:258

ConnectorTools - Main API for vendor-dependent tools

Usage:

typescript
// Get all tools for a connector
const tools = ConnectorTools.for('slack');

// Get just the generic API tool
const apiTool = ConnectorTools.genericAPI('github');

// Discover all available connector tools
const allTools = ConnectorTools.discoverAll();

// With scoped registry (access control)
const registry = Connector.scoped({ tenantId: 'acme' });
const tools = ConnectorTools.for('slack', undefined, { registry });
Static Methods

static enhanced()

Additive fixed audited contracts. Ordinary for()/factories/defaults are unchanged.

typescript
static enhanced(connectorOrName: Connector | string, options: EnhancedConnectorOptions): ToolFunction[]

Parameters:

  • connectorOrName: string | Connector
  • options: EnhancedConnectorOptions

Returns: ToolFunction<any, any>[]

static clearCache()

Clear all caches (useful for testing or when connectors change)

typescript
static clearCache(): void

Returns: void

static invalidateCache()

Invalidate cache for a specific connector

typescript
static invalidateCache(connectorName: string): void

Parameters:

  • connectorName: string

Returns: void

static registerService()

Register a tool factory for a service type

typescript
static registerService(serviceType: string, factory: ServiceToolFactory): void

Parameters:

  • serviceType: string
  • factory: ServiceToolFactory

Returns: void

static unregisterService()

Unregister a service tool factory

typescript
static unregisterService(serviceType: string): boolean

Parameters:

  • serviceType: string

Returns: boolean

static for()

Get ALL tools for a connector (generic API + service-specific) This is the main entry point

typescript
static for(connectorOrName: Connector | string, userId?: string, options?: ConnectorToolsOptions): ToolFunction[]

Parameters:

  • connectorOrName: string | Connector
  • userId: string | undefined (optional)
  • options: ConnectorToolsOptions | undefined (optional)

Returns: ToolFunction<any, any>[]

static discoverAll()

Discover tools for ALL registered connectors with external services Skips AI provider connectors (those with vendor but no serviceType)

typescript
static discoverAll(userId?: string, options?: ConnectorToolsOptions): Map<string, ToolFunction[]>

Parameters:

  • userId: string | undefined (optional)
  • options: ConnectorToolsOptions | undefined (optional)

Returns: Map<string, ToolFunction<any, any>[]>

static findConnector()

Find a connector by service type Returns the first connector matching the service type

typescript
static findConnector(serviceType: string, options?: ConnectorToolsOptions): Connector | undefined

Parameters:

  • serviceType: string
  • options: ConnectorToolsOptions | undefined (optional)

Returns: Connector | undefined

static findConnectors()

Find all connectors for a service type Useful when you have multiple connectors for the same service

typescript
static findConnectors(serviceType: string, options?: ConnectorToolsOptions): Connector[]

Parameters:

  • serviceType: string
  • options: ConnectorToolsOptions | undefined (optional)

Returns: Connector[]

static listSupportedServices()

List services that have registered tool factories

typescript
static listSupportedServices(): string[]

Returns: string[]

static hasServiceTools()

Check if a service has dedicated tool factory

typescript
static hasServiceTools(serviceType: string): boolean

Parameters:

  • serviceType: string

Returns: boolean

static detectService()

Detect the service type for a connector Uses explicit serviceType if set, otherwise infers from baseURL Results are cached for performance

typescript
static detectService(connector: Connector): string | undefined

Parameters:

  • connector: Connector

Returns: string | undefined

static forIdentities()

Generate tools for a set of auth identities. Each identity gets its own tool set with unique name prefixes.

typescript
static forIdentities(
    identities: AuthIdentity[],
    userId?: string,
    options?: { registry?: IConnectorRegistry }
  ): Map<string, ToolFunction[]>

Parameters:

  • identities: AuthIdentity[]
  • userId: string | undefined (optional)
  • options: { registry?: IConnectorRegistry | undefined; } | undefined (optional)

Returns: Map<string, ToolFunction<any, any>[]>


InvalidToolArgumentsError class

📍 src/domain/errors/AIErrors.ts:232

Constructor

constructor

typescript
constructor(
    toolName: string,
    public readonly rawArguments: string,
    public readonly parseError?: Error
  )

Parameters:

  • toolName: string
  • rawArguments: string
  • parseError: Error | undefined (optional)

MCPToolError class

📍 src/domain/errors/MCPError.ts:62

Tool execution errors (tool not found, tool execution failed)

Constructor

constructor

typescript
constructor(
    message: string,
    public readonly toolName: string,
    serverName?: string,
    cause?: Error
  )

Parameters:

  • message: string
  • toolName: string
  • serverName: string | undefined (optional)
  • cause: Error | undefined (optional)

RemoteToolExecutionError class

📍 src/portable/AgentPackage.ts:65

Constructor

constructor

typescript
constructor(code: string, message: string, retryable = false)

Parameters:

  • code: string
  • message: string
  • retryable: boolean (optional) (default: false)
Properties
Property Type Description
code code: string -
retryable retryable: boolean -

StoreToolsManager class

📍 src/core/context-nextgen/store-tools.ts:21

Constructor

constructor

typescript
constructor(private readonly promptView?: (handler: IStoreHandler) =>
    Pick<StoreEntrySchema, 'description' | 'usageHint'> | undefined)

Parameters:

  • promptView: ((handler: IStoreHandler) => Pick<StoreEntrySchema, "description" | "usageHint"> | undefined) | undefined (optional)
Methods

registerHandler()

Register a store handler. Throws on duplicate storeId.

typescript
registerHandler(handler: IStoreHandler): void

Parameters:

  • handler: IStoreHandler

Returns: void

unregisterHandler()

Unregister a store handler by storeId.

typescript
unregisterHandler(storeId: string): boolean

Parameters:

  • storeId: string

Returns: boolean

getHandler()

Get a handler by storeId.

typescript
getHandler(storeId: string): IStoreHandler | undefined

Parameters:

  • storeId: string

Returns: IStoreHandler | undefined

getSchemas()

Get all registered store schemas (for building tool descriptions).

typescript
getSchemas(): StoreEntrySchema[]

Returns: StoreEntrySchema[]

getStoreIds()

Get all registered store IDs.

typescript
getStoreIds(): string[]

Returns: string[]

getTools()

Create the 5 generic store tools. Called once when the first IStoreHandler is registered.

typescript
getTools(): ToolFunction[]

Returns: ToolFunction<any, any>[]

destroy()

Cleanup.

typescript
destroy(): void

Returns: void

buildOverview()

Build the unified overview block for system instructions. Emitted once when any IStoreHandler plugins are registered. Covers: what store_* tools are, available stores, and when to use each.

typescript
buildOverview(): string

Returns: string


ToolCatalogPluginNextGen class

📍 src/core/context-nextgen/plugins/ToolCatalogPluginNextGen.ts:137

Constructor

constructor

typescript
constructor(config?: ToolCatalogPluginConfig)

Parameters:

  • config: ToolCatalogPluginConfig | undefined (optional)
Methods

getInstructions()

typescript
getInstructions(): string

Returns: string

getInstructionsTokenSize()

typescript
getInstructionsTokenSize(): number

Returns: number

getContent()

typescript
async getContent(): Promise<string | null>

Returns: Promise<string | null>

getContents()

typescript
getContents(): unknown

Returns: unknown

getTools()

typescript
getTools(): ToolFunction[]

Returns: ToolFunction<any, any>[]

isCompactable()

typescript
isCompactable(): boolean

Returns: boolean

compact()

typescript
async compact(targetTokensToFree: number): Promise<number>

Parameters:

  • targetTokensToFree: number

Returns: Promise<number>

getState()

typescript
getState(): unknown

Returns: unknown

restoreState()

typescript
restoreState(state: unknown): void

Parameters:

  • state: unknown

Returns: void

destroy()

typescript
destroy(): void

Returns: void

setToolManager()

Set the ToolManager reference. Called by AgentContextNextGen after plugin registration.

typescript
setToolManager(tm: ToolManager): void

Parameters:

  • tm: ToolManager

Returns: void

executeLoad()

typescript
executeLoad(category: string): Record<string, unknown>

Parameters:

  • category: string

Returns: Record<string, unknown>

Properties
Property Type Description
name name: "tool_catalog" -

ToolCatalogRegistry class

📍 src/core/ToolCatalogRegistry.ts:144

Static global registry for tool categories and their tools.

Like Connector and StorageRegistry, this is a static class that acts as a single source of truth. App code registers categories at startup, and plugins/agents query them at runtime.

Static Methods

static toDisplayName()

Convert a hyphenated or plain name to a display name. E.g., 'custom-tools' → 'Custom Tools', 'filesystem' → 'Filesystem'

typescript
static toDisplayName(name: string): string

Parameters:

  • name: string

Returns: string

static parseConnectorCategory()

Parse a connector category name into connector name + optional accountId.

Formats:

  • 'connector:github' → { connectorName: 'github' }
  • 'connector:microsoft:work' → { connectorName: 'microsoft', accountId: 'work' }
  • 'filesystem' → null (not a connector category)
typescript
static parseConnectorCategory(category: string): ParsedConnectorCategory | null

Parameters:

  • category: string

Returns: ParsedConnectorCategory | null

static getConnectorToolsModule()

Get the ConnectorTools module (lazy-loaded, cached). Returns null if ConnectorTools is not available. Uses false sentinel to prevent retrying after first failure.

NOTE: The dynamic require() path fails in bundled environments (Meteor, Webpack). Call setConnectorToolsModule() at app startup to inject the module explicitly.

typescript
static getConnectorToolsModule(): { ConnectorTools: any } | null

Returns: { ConnectorTools: any; } | null

static setConnectorToolsModule()

Explicitly set the ConnectorTools module reference.

Use this in bundled environments (Meteor, Webpack, etc.) where the lazy require('../../tools/connector/ConnectorTools.js') fails due to path resolution.

typescript
static setConnectorToolsModule(mod: { ConnectorTools: any }): void

Parameters:

  • mod: { ConnectorTools: any; }

Returns: void

static registerCategory()

Register a tool category. If the category already exists, updates its metadata.

typescript
static registerCategory(def: ToolCategoryDefinition): void

Parameters:

  • def: ToolCategoryDefinition

Returns: void

static registerTools()

Register multiple tools in a category. The category is auto-created if it doesn't exist (with a generic description).

typescript
static registerTools(category: string, tools: CatalogToolEntry[]): void

Parameters:

  • category: string
  • tools: CatalogToolEntry[]

Returns: void

static registerTool()

Register a single tool in a category.

typescript
static registerTool(category: string, tool: CatalogToolEntry): void

Parameters:

  • category: string
  • tool: CatalogToolEntry

Returns: void

static unregisterCategory()

Unregister a category and all its tools.

typescript
static unregisterCategory(category: string): boolean

Parameters:

  • category: string

Returns: boolean

static unregisterTool()

Unregister a single tool from a category.

typescript
static unregisterTool(category: string, toolName: string): boolean

Parameters:

  • category: string
  • toolName: string

Returns: boolean

static getCategories()

Get all registered categories.

typescript
static getCategories(): ToolCategoryDefinition[]

Returns: ToolCategoryDefinition[]

static getCategory()

Get a single category by name.

typescript
static getCategory(name: string): ToolCategoryDefinition | undefined

Parameters:

  • name: string

Returns: ToolCategoryDefinition | undefined

static hasCategory()

Check if a category exists.

typescript
static hasCategory(name: string): boolean

Parameters:

  • name: string

Returns: boolean

static getToolsInCategory()

Get all tools in a category.

typescript
static getToolsInCategory(category: string): CatalogToolEntry[]

Parameters:

  • category: string

Returns: CatalogToolEntry[]

static getAllCatalogTools()

Get all catalog tools across all categories.

typescript
static getAllCatalogTools(): CatalogToolEntry[]

Returns: CatalogToolEntry[]

static findTool()

Find a tool by name across all categories.

typescript
static findTool(name: string): { category: string; entry: CatalogToolEntry } | undefined

Parameters:

  • name: string

Returns: { category: string; entry: CatalogToolEntry; } | undefined

static filterCategories()

Filter categories by scope.

typescript
static filterCategories(scope?: ToolCategoryScope): ToolCategoryDefinition[]

Parameters:

  • scope: ToolCategoryScope | undefined (optional)

Returns: ToolCategoryDefinition[]

static isCategoryAllowed()

Check if a category is allowed by a scope.

typescript
static isCategoryAllowed(name: string, scope?: ToolCategoryScope): boolean

Parameters:

  • name: string
  • scope: ToolCategoryScope | undefined (optional)

Returns: boolean

static discoverConnectorCategories()

Discover all connector categories with their tools.

When identities include accountId, uses ConnectorTools.forIdentities() to generate per-account categories (e.g., 'connector:microsoft:work', 'connector:microsoft:personal'). Without accountIds, falls back to ConnectorTools.discoverAll() for backward compatibility.

typescript
static discoverConnectorCategories(options?: {
    scope?: ToolCategoryScope;
    identities?: Array<{ connector: string; accountId?: string }>;
  }): ConnectorCategoryInfo[]

Parameters:

  • options: { scope?: ToolCategoryScope | undefined; identities?: { connector: string; accountId?: string | undefined; }[] | undefined; } | undefined (optional)

Returns: ConnectorCategoryInfo[]

static resolveConnectorCategoryTools()

Resolve tools for a specific connector category.

Supports both legacy format ('connector:github') and multi-account format ('connector:microsoft:work'). When accountId is present, generates account-prefixed tools via ConnectorTools.for(connectorName, { accountId }).

typescript
static resolveConnectorCategoryTools(category: string): Array<{ tool: ToolFunction; name: string }>

Parameters:

  • category: string

Returns: { tool: ToolFunction<any, any>; name: string; }[]

static resolveTools()

Resolve tool names to ToolFunction[].

Searches registered categories and (optionally) connector tools. Used by app-level executors (e.g., V25's OneRingAgentExecutor).

typescript
static resolveTools(
    toolNames: string[],
    options?: { includeConnectors?: boolean; userId?: string; context?: Record<string, unknown> },
  ): ToolFunction[]

Parameters:

  • toolNames: string[]
  • options: { includeConnectors?: boolean | undefined; userId?: string | undefined; context?: Record<string, unknown> | undefined; } | undefined (optional)

Returns: ToolFunction<any, any>[]

static resolveToolsGrouped()

Resolve tools grouped by connector name.

Tools with a connectorName go into byConnector; all others go into plain. Supports factory-based tool creation via createTool when context is provided.

typescript
static resolveToolsGrouped(
    toolNames: string[],
    context?: Record<string, unknown>,
    options?: { includeConnectors?: boolean },
  ): { plain: ToolFunction[]; byConnector: Map<string, ToolFunction[]> }

Parameters:

  • toolNames: string[]
  • context: Record<string, unknown> | undefined (optional)
  • options: { includeConnectors?: boolean | undefined; } | undefined (optional)

Returns: { plain: ToolFunction<any, any>[]; byConnector: Map<string, ToolFunction<any, any>[]>; }

static ensureInitialized()

Ensure built-in tools from registry.generated.ts are registered. Called lazily on first query.

In ESM environments, call initializeFromRegistry(toolRegistry) explicitly from your app startup instead of relying on auto-initialization.

typescript
static ensureInitialized(): void

Returns: void

static initializeFromRegistry()

Explicitly initialize from the generated tool registry. Call this at app startup in ESM environments where lazy require() doesn't work.

typescript
static initializeFromRegistry(registry: ToolRegistryEntry[]): void

Parameters:

  • registry: ToolRegistryEntry[]

Returns: void

static reset()

Reset the registry. Primarily for testing.

typescript
static reset(): void

Returns: void


ToolEvidenceMiddleware class

📍 src/core/evidence/ToolEvidenceMiddleware.ts:70

Opt-in post-settlement middleware, deliberately outside the execution plugin/error pipeline.

Constructor

constructor

typescript
constructor(config: ToolEvidenceConfig)

Parameters:

  • config: ToolEvidenceConfig
Methods

record()

typescript
async record(tool: ToolFunction, args: unknown, context: ToolContext, outcome: ToolExecutionOutcome,
    result?: { value: unknown }, late = false, observeWork?: (promise: Promise<unknown>) => void): Promise<ToolEvidenceDelivery>

Parameters:

  • tool: ToolFunction<any, any>
  • args: unknown
  • context: ToolContext
  • outcome: ToolExecutionOutcome
  • result: { value: unknown; } | undefined (optional)
  • late: boolean (optional) (default: false)
  • observeWork: ((promise: Promise<unknown>) => void) | undefined (optional)

Returns: Promise<ToolEvidenceDelivery>

Properties
Property Type Description
storage storage: IEvidenceStorage -

ToolExecutionError class

📍 src/domain/errors/AIErrors.ts:111

Constructor

constructor

typescript
constructor(
    toolName: string,
    message: string,
    public readonly originalError?: Error
  )

Parameters:

  • toolName: string
  • message: string
  • originalError: Error | undefined (optional)
Properties
Property Type Description
outcome? `outcome: ToolExecutionOutcome undefined`

ToolExecutionPipeline class

📍 src/core/tool-execution/ToolExecutionPipeline.ts:90

Tool Execution Pipeline

Manages a chain of plugins that can intercept and modify tool execution.

Example:

typescript
const pipeline = new ToolExecutionPipeline();

// Add plugins
pipeline.use(new LoggingPlugin());
pipeline.use(new AnalyticsPlugin());

// Execute tool
const result = await pipeline.execute(myTool, { arg: 'value' });
Constructor

constructor

typescript
constructor(options: ToolExecutionPipelineOptions = {})

Parameters:

  • options: ToolExecutionPipelineOptions (optional) (default: {})
Methods

use()

Register a plugin with the pipeline.

If a plugin with the same name is already registered, it will be unregistered first (calling its onUnregister hook) and replaced.

typescript
use(plugin: IToolExecutionPlugin): this

Parameters:

  • plugin: IToolExecutionPlugin

Returns: this

remove()

Remove a plugin by name.

typescript
remove(pluginName: string): boolean

Parameters:

  • pluginName: string

Returns: boolean

has()

Check if a plugin is registered.

typescript
has(pluginName: string): boolean

Parameters:

  • pluginName: string

Returns: boolean

get()

Get a registered plugin by name.

typescript
get(pluginName: string): IToolExecutionPlugin | undefined

Parameters:

  • pluginName: string

Returns: IToolExecutionPlugin | undefined

list()

List all registered plugins, sorted by priority.

typescript
list(): IToolExecutionPlugin[]

Returns: IToolExecutionPlugin[]

execute()

Execute a tool through the plugin pipeline.

Execution phases:

  1. beforeExecute hooks (in priority order, lowest first)
  2. Tool execution (if not aborted)
  3. afterExecute hooks (in reverse priority order for proper unwinding)
  4. onError hooks if any phase fails
typescript
async execute(tool: ToolFunction, args: unknown, options: PipelineExecutionOptions = {}): Promise<unknown>

Parameters:

  • tool: ToolFunction<any, any>
  • args: unknown
  • options: PipelineExecutionOptions (optional) (default: {})

Returns: Promise<unknown>


ToolManager class

📍 src/core/ToolManager.ts:242

Constructor

constructor

typescript
constructor(config?: ToolManagerConfig)

Parameters:

  • config: ToolManagerConfig | undefined (optional)
Methods

destroy()

Releases all resources held by this ToolManager. Cleans up circuit breaker listeners and removes all event listeners. Safe to call multiple times (idempotent).

typescript
destroy(): void

Returns: void

setToolContext()

Set tool context for execution (called by agent before runs). WARNING: This REPLACES the entire context. Prefer mergeToolContext() for partial updates.

typescript
setToolContext(context: ToolContext | undefined): void

Parameters:

  • context: ToolContext | undefined

Returns: void

mergeToolContext()

Merge partial updates into the existing tool context. Unlike setToolContext(), this preserves fields not present in the partial update. Use this when updating userId or connectorAccounts without wiping agentId, identities, etc.

typescript
mergeToolContext(partial: Partial<ToolContext>): void

Parameters:

  • partial: Partial<ToolContext>

Returns: void

getToolContext()

Get current tool context

typescript
getToolContext(): ToolContext | undefined

Returns: ToolContext | undefined

setPermissionManager()

Set permission policy manager for tool execution enforcement.

Registers a PermissionEnforcementPlugin on the execution pipeline at priority 1. This gates ALL tool execution through the policy chain — no bypasses.

typescript
setPermissionManager(manager: PermissionPolicyManager): void

Parameters:

  • manager: PermissionPolicyManager

Returns: void

getPermissionManager()

Get the permission policy manager (if enforcement is active).

typescript
getPermissionManager(): PermissionPolicyManager | undefined

Returns: PermissionPolicyManager | undefined

hasPermissionEnforcement()

Check if permission enforcement is active on the execution pipeline.

typescript
hasPermissionEnforcement(): boolean

Returns: boolean

register()

Register a tool with optional configuration

typescript
register(tool: ToolFunction, options: ToolOptions = {}): void

Parameters:

  • tool: ToolFunction<any, any>
  • options: ToolOptions (optional) (default: {})

Returns: void

registerMany()

Register multiple tools at once

typescript
registerMany(tools: ToolFunction[], options: Omit<ToolOptions, 'conditions'> = {}): void

Parameters:

  • tools: ToolFunction<any, any>[]
  • options: Omit<ToolOptions, "conditions"> (optional) (default: {})

Returns: void

registerConnectorTools()

Register tools produced by a specific connector. Sets source: 'connector:<connectorName>' (or 'connector:<name>:<accountId>' for identity-bound tools) so agent-level filtering can restrict which connector tools are visible to a given agent.

typescript
registerConnectorTools(connectorName: string, tools: ToolFunction[], options: Omit&lt;ToolOptions, 'source'&gt; & { accountId?: string } = {}): void

Parameters:

  • connectorName: string
  • tools: ToolFunction&lt;any, any&gt;[]
  • options: Omit&lt;ToolOptions, "source"&gt; & { accountId?: string | undefined; } (optional) (default: {})

Returns: void

unregister()

Unregister a tool by name

typescript
unregister(name: string): boolean

Parameters:

  • name: string

Returns: boolean

clear()

Clear all tools and their circuit breakers. Does NOT remove event listeners from this ToolManager (use destroy() for full cleanup).

typescript
clear(): void

Returns: void

enable()

Enable a tool by name

typescript
enable(name: string): boolean

Parameters:

  • name: string

Returns: boolean

disable()

Disable a tool by name (keeps it registered but inactive)

typescript
disable(name: string): boolean

Parameters:

  • name: string

Returns: boolean

toggle()

Toggle a tool's enabled state

typescript
toggle(name: string): boolean

Parameters:

  • name: string

Returns: boolean

isEnabled()

Check if a tool is enabled

typescript
isEnabled(name: string): boolean

Parameters:

  • name: string

Returns: boolean

setEnabled()

Set enabled state for multiple tools

typescript
setEnabled(names: string[], enabled: boolean): void

Parameters:

  • names: string[]
  • enabled: boolean

Returns: void

setNamespace()

Set the namespace for a tool

typescript
setNamespace(toolName: string, namespace: string): boolean

Parameters:

  • toolName: string
  • namespace: string

Returns: boolean

enableNamespace()

Enable all tools in a namespace

typescript
enableNamespace(namespace: string): void

Parameters:

  • namespace: string

Returns: void

disableNamespace()

Disable all tools in a namespace

typescript
disableNamespace(namespace: string): void

Parameters:

  • namespace: string

Returns: void

getNamespaces()

Get all namespace names

typescript
getNamespaces(): string[]

Returns: string[]

createNamespace()

Create a namespace with tools

typescript
createNamespace(namespace: string, tools: ToolFunction[], options: Omit&lt;ToolOptions, 'namespace'&gt; = {}): void

Parameters:

  • namespace: string
  • tools: ToolFunction&lt;any, any&gt;[]
  • options: Omit&lt;ToolOptions, "namespace"&gt; (optional) (default: {})

Returns: void

setPriority()

Set priority for a tool

typescript
setPriority(name: string, priority: number): boolean

Parameters:

  • name: string
  • priority: number

Returns: boolean

getPriority()

Get priority for a tool

typescript
getPriority(name: string): number | undefined

Parameters:

  • name: string

Returns: number | undefined

getPermission()

Get permission config for a tool

typescript
getPermission(name: string): ToolPermissionConfig | undefined

Parameters:

  • name: string

Returns: ToolPermissionConfig | undefined

setPermission()

Set permission config for a tool

typescript
setPermission(name: string, permission: ToolPermissionConfig): boolean

Parameters:

  • name: string
  • permission: ToolPermissionConfig

Returns: boolean

get()

Get a tool by name

typescript
get(name: string): ToolFunction | undefined

Parameters:

  • name: string

Returns: ToolFunction&lt;any, any&gt; | undefined

has()

Check if a tool exists

typescript
has(name: string): boolean

Parameters:

  • name: string

Returns: boolean

getEnabled()

Get all enabled tools (sorted by priority)

typescript
getEnabled(): ToolFunction[]

Returns: ToolFunction&lt;any, any&gt;[]

getEnabledRegistrations()

Get all enabled registrations (sorted by priority). Includes full registration metadata (source, namespace, etc.) for use in connector-aware filtering.

typescript
getEnabledRegistrations(): ToolRegistration[]

Returns: ToolRegistration[]

getAll()

Get all tools (enabled and disabled)

typescript
getAll(): ToolFunction[]

Returns: ToolFunction&lt;any, any&gt;[]

getByNamespace()

Get tools by namespace

typescript
getByNamespace(namespace: string): ToolFunction[]

Parameters:

  • namespace: string

Returns: ToolFunction&lt;any, any&gt;[]

getByCategory()

Get all registered tool names in a category. Used by ToolCatalogPlugin for bulk enable/disable.

typescript
getByCategory(category: string): string[]

Parameters:

  • category: string

Returns: string[]

getRegistration()

Get tool registration info

typescript
getRegistration(name: string): ToolRegistration | undefined

Parameters:

  • name: string

Returns: ToolRegistration | undefined

list()

List all tool names

typescript
list(): string[]

Returns: string[]

listEnabled()

List enabled tool names

typescript
listEnabled(): string[]

Returns: string[]

listCompact()

Slim catalog of currently enabled tools — name + description, no parameter schemas.

Used by routine builders to discover what's available on a superagent without paying the token cost of full tool definitions. Each entry includes:

  • name: the LLM-facing tool name (already connector-prefixed for connector tools, e.g. msft-personal_send_email)
  • description: the tool's definition.function.description
  • category: optional grouping
  • connectorName: present for connector-bound tools (read from tool.connectorName, falling back to parsing the registration source like 'connector:msft-personal' or 'connector:msft-personal:account-id')

Disabled tools are excluded — they're not actually callable by the LLM, so listing them would mislead a routine builder.

typescript
listCompact(): CompactToolDescriptor[]

Returns: CompactToolDescriptor[]

selectForContext()

Select tools based on context (uses conditions and smart filtering)

typescript
selectForContext(context: ToolSelectionContext): ToolFunction[]

Parameters:

  • context: ToolSelectionContext

Returns: ToolFunction&lt;any, any&gt;[]

selectByCapability()

Select tools by matching capability description

typescript
selectByCapability(description: string): ToolFunction[]

Parameters:

  • description: string

Returns: ToolFunction&lt;any, any&gt;[]

selectWithinBudget()

Filter tools to fit within a token budget

typescript
selectWithinBudget(budget: number): ToolFunction[]

Parameters:

  • budget: number

Returns: ToolFunction&lt;any, any&gt;[]

recordExecution()

Record tool execution (called by agent/loop)

typescript
recordExecution(
    name: string,
    executionMs: number,
    success: boolean
  ): void

Parameters:

  • name: string
  • executionMs: number
  • success: boolean

Returns: void

getStats()

Get comprehensive statistics

typescript
getStats(): ToolManagerStats

Returns: ToolManagerStats

setEvidenceMiddleware()

Opt-in post-settlement evidence handling. Does not replace the execution pipeline.

typescript
setEvidenceMiddleware(middleware?: ToolEvidenceMiddleware): void

Parameters:

  • middleware: ToolEvidenceMiddleware | undefined (optional)

Returns: void

execute()

Execute a tool function with circuit breaker protection and plugin pipeline. Implements IToolExecutor interface.

Execution flow:

  1. Validate tool exists and is enabled
  2. Check circuit breaker state
  3. Run through plugin pipeline (beforeExecute -> execute -> afterExecute)
  4. Update metrics and circuit breaker state

Simple execution - no caching, no parent context. Context must be set via setToolContext() before calling.

typescript
async execute(toolName: string, args: any, options?: ToolExecutionOptions): Promise&lt;any&gt;

Parameters:

  • toolName: string
  • args: any
  • options: ToolExecutionOptions | undefined (optional)

Returns: Promise&lt;any&gt;

executeWithOutcome()

Execute with semantic metadata while retaining the legacy raw result contract.

typescript
async executeWithOutcome(toolName: string, args: any, options: ToolExecutionOptions = {}): Promise&lt;ToolExecutionReport&lt;any&gt;&gt;

Parameters:

  • toolName: string
  • args: any
  • options: ToolExecutionOptions (optional) (default: {})

Returns: Promise&lt;ToolExecutionReport&lt;any&gt;&gt;

hasToolFunction()

Check if tool is available (IToolExecutor interface)

typescript
hasToolFunction(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

getToolDefinition()

Get tool definition (IToolExecutor interface)

typescript
getToolDefinition(toolName: string): Tool | undefined

Parameters:

  • toolName: string

Returns: Tool | undefined

registerTool()

Register a tool (IToolExecutor interface - delegates to register())

typescript
registerTool(tool: ToolFunction): void

Parameters:

  • tool: ToolFunction&lt;any, any&gt;

Returns: void

unregisterTool()

Unregister a tool (IToolExecutor interface - delegates to unregister())

typescript
unregisterTool(toolName: string): void

Parameters:

  • toolName: string

Returns: void

listTools()

List all registered tool names (IToolExecutor interface - delegates to list())

typescript
listTools(): string[]

Returns: string[]

getCircuitBreakerStates()

Get circuit breaker states for all tools

typescript
getCircuitBreakerStates(): Map&lt;string, CircuitState&gt;

Returns: Map&lt;string, CircuitState&gt;

getToolCircuitBreakerMetrics()

Get circuit breaker metrics for a specific tool

typescript
getToolCircuitBreakerMetrics(toolName: string)

Parameters:

  • toolName: string

Returns: CircuitBreakerMetrics | undefined

resetToolCircuitBreaker()

Manually reset a tool's circuit breaker

typescript
resetToolCircuitBreaker(toolName: string): void

Parameters:

  • toolName: string

Returns: void

setCircuitBreakerConfig()

Configure circuit breaker for a tool

typescript
setCircuitBreakerConfig(toolName: string, config: CircuitBreakerConfig): boolean

Parameters:

  • toolName: string
  • config: CircuitBreakerConfig

Returns: boolean

getState()

Get serializable state (for session persistence)

typescript
getState(): SerializedToolState

Returns: SerializedToolState

loadState()

Load state (restores enabled/disabled, namespaces, priorities, permissions) Note: Tools must be re-registered separately (they contain functions)

typescript
loadState(state: SerializedToolState): void

Parameters:

  • state: SerializedToolState

Returns: void


ToolNotFoundError class

📍 src/domain/errors/AIErrors.ts:145

Constructor

constructor

typescript
constructor(toolName: string)

Parameters:

  • toolName: string

ToolPermissionManager class

📍 src/core/permissions/ToolPermissionManager.ts:56

Constructor

constructor

typescript
constructor(config?: AgentPermissionsConfig)

Parameters:

  • config: AgentPermissionsConfig | undefined (optional)
Methods

checkPermission()

Check if a tool needs approval before execution

typescript
checkPermission(toolName: string, _args?: Record&lt;string, unknown&gt;): PermissionCheckResult

Parameters:

  • toolName: string
  • _args: Record&lt;string, unknown&gt; | undefined (optional)

Returns: PermissionCheckResult

needsApproval()

Check if a tool call needs approval (uses ToolCall object)

typescript
needsApproval(toolCall: ToolCall): boolean

Parameters:

  • toolCall: ToolCall

Returns: boolean

isBlocked()

Check if a tool is blocked

typescript
isBlocked(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

isApproved()

Check if a tool is approved (either allowlisted or session-approved)

typescript
isApproved(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

approve()

Approve a tool (record approval)

typescript
approve(toolName: string, decision?: Partial&lt;ApprovalDecision&gt;): void

Parameters:

  • toolName: string
  • decision: Partial&lt;ApprovalDecision&gt; | undefined (optional)

Returns: void

approveForSession()

Approve a tool for the entire session

typescript
approveForSession(toolName: string, approvedBy?: string): void

Parameters:

  • toolName: string
  • approvedBy: string | undefined (optional)

Returns: void

revoke()

Revoke a tool's approval

typescript
revoke(toolName: string): void

Parameters:

  • toolName: string

Returns: void

deny()

Deny a tool execution (for audit trail)

typescript
deny(toolName: string, reason: string): void

Parameters:

  • toolName: string
  • reason: string

Returns: void

isApprovedForSession()

Check if a tool has been approved for the current session

typescript
isApprovedForSession(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

allowlistAdd()

Add a tool to the allowlist (always allowed)

typescript
allowlistAdd(toolName: string): void

Parameters:

  • toolName: string

Returns: void

allowlistRemove()

Remove a tool from the allowlist

typescript
allowlistRemove(toolName: string): void

Parameters:

  • toolName: string

Returns: void

isAllowlisted()

Check if a tool is in the allowlist

typescript
isAllowlisted(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

getAllowlist()

Get all allowlisted tools

typescript
getAllowlist(): string[]

Returns: string[]

blocklistAdd()

Add a tool to the blocklist (always blocked)

typescript
blocklistAdd(toolName: string): void

Parameters:

  • toolName: string

Returns: void

blocklistRemove()

Remove a tool from the blocklist

typescript
blocklistRemove(toolName: string): void

Parameters:

  • toolName: string

Returns: void

isBlocklisted()

Check if a tool is in the blocklist

typescript
isBlocklisted(toolName: string): boolean

Parameters:

  • toolName: string

Returns: boolean

getBlocklist()

Get all blocklisted tools

typescript
getBlocklist(): string[]

Returns: string[]

setToolConfig()

Set permission config for a specific tool

typescript
setToolConfig(toolName: string, config: ToolPermissionConfig): void

Parameters:

  • toolName: string
  • config: ToolPermissionConfig

Returns: void

getToolConfig()

Get permission config for a specific tool

typescript
getToolConfig(toolName: string): ToolPermissionConfig | undefined

Parameters:

  • toolName: string

Returns: ToolPermissionConfig | undefined

getEffectiveConfig()

Get effective config (tool-specific or defaults)

typescript
getEffectiveConfig(toolName: string): ToolPermissionConfig

Parameters:

  • toolName: string

Returns: ToolPermissionConfig

requestApproval()

Request approval for a tool call

If an onApprovalRequired callback is set, it will be called. Otherwise, this auto-approves for backward compatibility.

NOTE: If you want to require explicit approval, you MUST either:

  1. Set onApprovalRequired callback in AgentPermissionsConfig
  2. Register an 'approve:tool' hook in the Agent
  3. Add tools to the blocklist if they should never run

This auto-approval behavior preserves backward compatibility with existing code that doesn't use the permission system.

typescript
async requestApproval(context: PermissionCheckContext): Promise&lt;ApprovalDecision&gt;

Parameters:

  • context: PermissionCheckContext

Returns: Promise&lt;ApprovalDecision&gt;

getApprovedTools()

Get all tools that have session approvals

typescript
getApprovedTools(): string[]

Returns: string[]

getApprovalEntry()

Get the approval entry for a tool

typescript
getApprovalEntry(toolName: string): ApprovalCacheEntry | undefined

Parameters:

  • toolName: string

Returns: ApprovalCacheEntry | undefined

clearSession()

Clear all session approvals

typescript
clearSession(): void

Returns: void

getState()

Serialize approval state for persistence

typescript
getState(): SerializedApprovalState

Returns: SerializedApprovalState

loadState()

Load approval state from persistence

typescript
loadState(state: SerializedApprovalState): void

Parameters:

  • state: SerializedApprovalState

Returns: void

getDefaults()

Get defaults

typescript
getDefaults(): { scope: PermissionScope; riskLevel: RiskLevel }

Returns: { scope: PermissionScope; riskLevel: RiskLevel; }

setDefaults()

Set defaults

typescript
setDefaults(defaults: { scope?: PermissionScope; riskLevel?: RiskLevel }): void

Parameters:

  • defaults: { scope?: PermissionScope | undefined; riskLevel?: RiskLevel | undefined; }

Returns: void

getStats()

Get summary statistics

typescript
getStats(): {
    approvedCount: number;
    allowlistedCount: number;
    blocklistedCount: number;
    configuredCount: number;
  }

Returns: { approvedCount: number; allowlistedCount: number; blocklistedCount: number; configuredCount: number; }

reset()

Reset to initial state

typescript
reset(): void

Returns: void

destroy()

Destroy the permission manager and release all resources

typescript
destroy(): void

Returns: void


ToolRegistry class

📍 src/tools/ToolRegistry.ts:43

Unified tool registry that combines built-in and connector tools

Static Methods

static getBuiltInTools()

Get built-in tools only (from registry.generated.ts)

typescript
static getBuiltInTools(): ToolRegistryEntry[]

Returns: ToolRegistryEntry[]

static getConnectorTools()

Get tools for a specific connector

typescript
static getConnectorTools(connectorName: string): ConnectorToolEntry[]

Parameters:

  • connectorName: string

Returns: ConnectorToolEntry[]

static getAllConnectorTools()

Get all connector tools from all registered service connectors

This discovers tools from all connectors that have:

  • Explicit serviceType, OR
  • baseURL but no vendor (external API, not AI provider)
typescript
static getAllConnectorTools(): ConnectorToolEntry[]

Returns: ConnectorToolEntry[]

static getAllTools()

Get ALL tools (built-in + connector) - main API for UIs

This is the primary method for getting a complete list of available tools.

typescript
static getAllTools(): (ToolRegistryEntry | ConnectorToolEntry)[]

Returns: (ToolRegistryEntry | ConnectorToolEntry)[]

static getToolsByService()

Get tools filtered by service type

typescript
static getToolsByService(serviceType: string): ConnectorToolEntry[]

Parameters:

  • serviceType: string

Returns: ConnectorToolEntry[]

static getToolsByConnector()

Get tools filtered by connector name

typescript
static getToolsByConnector(connectorName: string): ConnectorToolEntry[]

Parameters:

  • connectorName: string

Returns: ConnectorToolEntry[]

static isConnectorTool()

Check if a tool entry is a connector tool

typescript
static isConnectorTool(entry: ToolRegistryEntry | ConnectorToolEntry): entry is ConnectorToolEntry

Parameters:

  • entry: ToolRegistryEntry | ConnectorToolEntry

Returns: boolean


ToolTimeoutError class

📍 src/domain/errors/AIErrors.ts:130

Constructor

constructor

typescript
constructor(
    toolName: string,
    public readonly timeoutMs: number
  )

Parameters:

  • toolName: string
  • timeoutMs: number

AfterToolContext interface

📍 src/capabilities/agents/types/HookTypes.ts:69

Properties
Property Type Description
executionId executionId: string; -
iteration iteration: number; -
toolCall toolCall: ToolCall; -
result result: ToolResult; -
context context: ExecutionContext; -
timestamp timestamp: Date; -

AgentPackageOutcomeToolOptions interface

📍 src/portable/outcomeTypes.ts:135

Build tools before Agent/C6 factory construction, using the same evidence backend handle.

Methods

onObservation()?

typescript
onObservation?(report: Readonly&lt;RemoteOutcomeReport&gt;): void;

Parameters:

  • report: Readonly&lt;RemoteOutcomeReport&gt;

Returns: void

Properties
Property Type Description
transport transport: RemoteOutcomeTransport; -
storage storage: IEvidenceStorage; -
maxRequests? maxRequests?: number; -

AgentPackageOutcomeTools interface

📍 src/portable/outcomeTypes.ts:141

Properties
Property Type Description
tools tools: ToolFunction[]; -
session session: RemoteOutcomeSession -

ApproveToolContext interface

📍 src/capabilities/agents/types/HookTypes.ts:78

Properties
Property Type Description
executionId executionId: string; -
iteration iteration: number; -
toolCall toolCall: ToolCall; -
context context: ExecutionContext; -
timestamp timestamp: Date; -

AsyncToolConfig interface

📍 src/domain/entities/Tool.ts:118

Configuration for async (non-blocking) tool behavior

Properties
Property Type Description
autoContinue? autoContinue?: boolean; If true, the agent automatically re-enters the agentic loop
when async tool results arrive. If false, results are queued
and the caller must call continueWithAsyncResults() manually.
batchWindowMs? batchWindowMs?: number; Window in ms to batch multiple async results before triggering
a continuation. If multiple async tools complete within this window,
their results are delivered together in a single user message.
asyncTimeout? asyncTimeout?: number; Timeout in ms for async tool execution. If a tool doesn't complete
within this window, it's treated as a timeout error.

BeforeToolContext interface

📍 src/capabilities/agents/types/HookTypes.ts:61

Properties
Property Type Description
executionId executionId: string; -
iteration iteration: number; -
toolCall toolCall: ToolCall; -
context context: ExecutionContext; -
timestamp timestamp: Date; -

BuiltInTool interface

📍 src/domain/entities/Tool.ts:58

Properties
Property Type Description
type `type: 'web_search' 'file_search'
blocking? blocking?: boolean; -

CatalogToolEntry interface

📍 src/core/ToolCatalogRegistry.ts:52

A single tool entry in the catalog.

Properties
Property Type Description
tool? tool?: ToolFunction; The actual tool function (optional when createTool factory is provided)
name name: string; Tool name (matches definition.function.name)
displayName displayName: string; Human-readable display name
description description: string; Brief description
safeByDefault safeByDefault: boolean; Whether this tool is safe to execute without user approval
requiresConnector? requiresConnector?: boolean; Whether this tool requires a connector to function
createTool? createTool?: (ctx: Record&lt;string, unknown&gt;) =&gt; ToolFunction; Factory for runtime tool creation (e.g., browser tools needing context)
source? source?: string; Source identifier (e.g., 'oneringai', 'hosea', 'custom')
connectorName? connectorName?: string; Connector name (for connector-originated tools)
serviceType? serviceType?: string; Service type (e.g., 'github', 'slack')
connectorServiceTypes? connectorServiceTypes?: string[]; Supported connector service types

ConnectorCategoryInfo interface

📍 src/core/ToolCatalogRegistry.ts:118

Connector category metadata returned by discoverConnectorCategories().

Properties
Property Type Description
name name: string; Category name in 'connector:' or 'connector::' format
displayName displayName: string; Human-readable display name
description description: string; Description
toolCount toolCount: number; Number of tools
tools tools: ToolFunction[]; Resolved tools
accountId? accountId?: string; Account alias for multi-account connectors

ConnectorToolEntry interface

📍 src/tools/ToolRegistry.ts:33

Extended registry entry for connector-generated tools

Properties
Property Type Description
connectorName connectorName: string; Name of the connector that generated this tool
serviceType? serviceType?: string; Service type (e.g., 'github', 'slack') if detected

ConnectorToolsOptions interface

📍 src/tools/connector/ConnectorTools.ts:185

Options for ConnectorTools methods that accept a scoped registry

Properties
Property Type Description
registry? registry?: IConnectorRegistry; Optional scoped registry for access-controlled connector lookup
accountId? accountId?: string; Account alias for multi-account OAuth. When set, tools are prefixed with accountId and context is bound.
actAs? actAs?: string; Lock the on-behalf-of user identity for tools that act as a specific user
(Microsoft Graph /users/{id}, Google API userId). Set ONCE at tool
instantiation; the LLM cannot override it at call time.
  • When set: the per-tool targetUser schema parameter is OMITTED and this value is always used.
  • When unset: existing behavior (LLM supplies targetUser for app-only auth).
  • Silently ignored for delegated connectors (identity already bound by token).
  • Empty / whitespace-only strings are treated as unset.

Use this when wiring a single shared app-token connector into a specific agent that should only ever operate on behalf of one user. The connector itself stays generic and can be reused with different actAs values across different agents.

SCOPE — only tools whose request URL is user-scoped participate in the lock. Tools that hit endpoints which are not user-scoped at the URL level (Microsoft /search/query; Google /drive/v3/files, /calendar/v3/freeBusy) do NOT take actAs and are unaffected by it — they always work with whatever the underlying token can see. Each non-participating tool's factory carries a NOTE on actAs lock doc block explaining the data-scope guarantee for that specific tool. If you need true per-user isolation for those tools, use a delegated connector (where the OAuth token binds identity directly). |


CreateRequestUserInputToolOptions interface

📍 src/tools/interaction/requestUserInput.ts:54

Properties
Property Type Description
toolName? toolName?: string; Tool name surfaced to the LLM. Default: 'request_user_input'.
description? description?: string; Override the tool description. The default description tells the model
to call this when it genuinely needs a human decision/answer that it
cannot produce itself, and warns that the agent will pause until reply.
ttl? ttl?: number; SuspendSignal TTL in milliseconds (how long to keep the correlation
before it expires). Defaults to the library's SuspendSignal default
(7 days at the time of writing).
resumeAs? `resumeAs?: 'user_message' 'tool_result';`
  • 'tool_result' (default): the reply becomes the tool's actual output — semantically honest ("I asked → user answered → tool returned").
  • 'user_message': reply is added as a fresh user turn — useful when you want the resumed turn to feel conversational. |

CreateRoutineToolOptions interface

📍 src/core/createRoutineTool.ts:38

Properties
Property Type Description
definition definition: RoutineDefinition; The routine definition to wrap as a tool.
createAgent `createAgent: () => Agent Promise<Agent>;`
Called every time the tool is executed — the agent is destroyed after the routine completes.
toolName? toolName?: string; Override tool name. Default: 'routine_{sanitized_definition_name}'.
Must be unique among all registered tools.

CustomToolCallOutputItem interface

📍 src/domain/entities/Message.ts:68

Top-level custom-tool result item for Responses continuations.

Properties
Property Type Description
type type: 'custom_tool_call_output'; -
call_id call_id: string; -
output `output: string ToolCallOutputContent[];`

CustomToolDefinition interface

📍 src/domain/entities/CustomToolDefinition.ts:54

Full custom tool definition - everything needed to hydrate into a ToolFunction

Properties
Property Type Description
version version: number; Format version for migration support
name name: string; Unique tool name (must match /^[a-z][a-z0-9_]*$/)
displayName? displayName?: string; Human-readable display name
description description: string; Description of what the tool does
inputSchema inputSchema: Record&lt;string, unknown&gt;; JSON Schema for input parameters
outputSchema? outputSchema?: Record&lt;string, unknown&gt;; JSON Schema for output (documentation only)
code code: string; JavaScript code to execute in VM sandbox
createdAt createdAt: string; When the definition was created
updatedAt updatedAt: string; When the definition was last updated
metadata? metadata?: CustomToolMetadata; Optional metadata

CustomToolListOptions interface

📍 src/domain/interfaces/ICustomToolStorage.ts:14

Options for listing custom tools

Properties
Property Type Description
tags? tags?: string[]; Filter by tags (any match)
category? category?: string; Filter by category
search? search?: string; Search string (case-insensitive substring match on name + description)
limit? limit?: number; Maximum number of results
offset? offset?: number; Offset for pagination

CustomToolMetadata interface

📍 src/domain/entities/CustomToolDefinition.ts:32

Metadata for a custom tool

Properties
Property Type Description
tags? tags?: string[]; Tags for categorization and search
category? category?: string; Category grouping
author? author?: string; Author/creator identifier
generationPrompt? generationPrompt?: string; The prompt that was used to generate this tool
testCases? testCases?: CustomToolTestCase[]; Test cases for validation
requiresConnector? requiresConnector?: boolean; Whether this tool requires a connector to function
connectorNames? connectorNames?: string[]; Connector names this tool uses

CustomToolMetaToolsOptions interface

📍 src/tools/custom-tools/factories.ts:17

Properties
Property Type Description
storage? storage?: ICustomToolStorage; Custom storage backend. Default: FileCustomToolStorage

CustomToolResultContent interface

📍 src/domain/entities/Content.ts:77

Properties
Property Type Description
evidence? evidence?: ToolResultEvidence; -
type type: ContentType.CUSTOM_TOOL_RESULT; -
tool_use_id tool_use_id: string; -
content `content: string any;`
error? error?: string; -

CustomToolSummary interface

📍 src/domain/entities/CustomToolDefinition.ts:80

Lightweight summary of a custom tool (no code) - used for listing

Properties
Property Type Description
name name: string; Tool name
displayName? displayName?: string; Human-readable display name
description description: string; Description
createdAt createdAt: string; When created
updatedAt updatedAt: string; When last updated
metadata? metadata?: CustomToolMetadata; Optional metadata

CustomToolTestCase interface

📍 src/domain/entities/CustomToolDefinition.ts:16

Test case for a custom tool

Properties
Property Type Description
label label: string; Human-readable label for this test case
input input: unknown; Input to pass to the tool
expectedOutput? expectedOutput?: unknown; Expected output (for validation)
lastResult? lastResult?: unknown; Result from last test run
lastError? lastError?: string; Error from last test run

CustomToolUseContent interface

📍 src/domain/entities/Content.ts:60

Properties
Property Type Description
type type: ContentType.CUSTOM_TOOL_USE; -
id id: string; -
name name: string; -
input input: string; -
async? async?: boolean; Whether the provider marked this as an async protocol call.

DesktopToolConfig interface

📍 src/tools/desktop/types.ts:95

Properties
Property Type Description
driver? driver?: IDesktopDriver; Custom driver implementation (defaults to NutTreeDriver)
humanDelay? humanDelay?: [number, number]; Human-like delay range in ms added between actions.
Set to [0, 0] for instant actions.
Default: [50, 150]
humanizeMovement? humanizeMovement?: boolean; Whether to humanize mouse movements (curved path vs instant teleport).
Default: false

FilesystemToolConfig interface

📍 src/tools/filesystem/types.ts:15

Configuration for filesystem tools

Properties
Property Type Description
workingDirectory? workingDirectory?: string; Base working directory for all operations.
All paths will be resolved relative to this directory.
Defaults to process.cwd()
allowedDirectories? allowedDirectories?: string[]; Allowed directories for file operations.
If specified, operations outside these directories will be blocked.
Paths can be absolute or relative to workingDirectory.
blockedDirectories? blockedDirectories?: string[]; Blocked directories (e.g., node_modules, .git).
Operations in these directories will be blocked.
maxFileSize? maxFileSize?: number; Maximum file size to read (in bytes).
Default: 10MB
maxResults? maxResults?: number; Maximum number of results for glob/grep operations.
Default: 1000
followSymlinks? followSymlinks?: boolean; Whether to follow symlinks.
Default: false
excludeExtensions? excludeExtensions?: string[]; File extensions to exclude from search.
Default: common binary extensions
documentReaderConfig? documentReaderConfig?: DocumentReaderConfig; Document reader config for non-text file formats (PDF, DOCX, XLSX, etc.).
When set, read_file will automatically convert binary document formats to markdown.

FreeformToolDefinition interface

📍 src/domain/entities/Tool.ts:47

Free-form custom tool definition used by providers that accept text input.

Properties
Property Type Description
type type: 'custom'; -
name name: string; -
description? description?: string; -
format? format?: Record&lt;string, unknown&gt;; -
async? async?: boolean; OpenAI Responses async tool calling protocol flag.
allowedCallers? `allowedCallers?: Array<'direct' 'programmatic'>;`
deferLoading? deferLoading?: boolean; -

FunctionToolDefinition interface

📍 src/domain/entities/Tool.ts:19

Properties
Property Type Description
type type: 'function'; -
function `function: {
name: string;
description?: string;
parameters?: JSONSchema;
strict?: boolean; // Enforce schema strictly

};| - | |async?|async?: boolean;` | OpenAI Responses async tool calling. When true, a compatible model may continue its turn while the host executes this function. The eventual result must be returned with the original call ID.

This is a provider protocol flag and is distinct from blocking: false, which controls OneRingAI's managed agent execution loop. | | allowedCallers? | allowedCallers?: Array&lt;'direct' | 'programmatic'&gt;; | OpenAI tool invocation contexts. | | deferLoading? | deferLoading?: boolean; | Defer this tool for provider tool-search discovery. | | outputSchema? | outputSchema?: JSONSchema; | Schema for the JSON value encoded in the function output string. | | blocking? | blocking?: boolean; | - | | timeout? | timeout?: number; | - |


GenericAPICallArgs interface

📍 src/tools/connector/ConnectorTools.ts:164

Arguments for the generic API call tool

Properties
Property Type Description
method `method: 'GET' 'POST'
endpoint endpoint: string; -
body? body?: Record&lt;string, unknown&gt;; -
queryParams? `queryParams?: Record<string, string number
headers? headers?: Record&lt;string, string&gt;; -

GenericAPICallResult interface

📍 src/tools/connector/ConnectorTools.ts:175

Result from the generic API call tool

Properties
Property Type Description
success success: boolean; -
status? status?: number; -
data? data?: unknown; -
error? error?: string; -

ICustomToolStorage interface

📍 src/domain/interfaces/ICustomToolStorage.ts:36

Storage interface for custom tool definitions

Custom tools support optional per-user isolation for multi-tenant scenarios. When userId is not provided, defaults to 'default' user.

Implementations:

  • FileCustomToolStorage: File-based storage at ~/.oneringai/users//custom-tools/
Methods

save()

Save a custom tool definition

typescript
save(userId: string | undefined, definition: CustomToolDefinition): Promise&lt;void&gt;;

Parameters:

  • userId: string | undefined
  • definition: CustomToolDefinition

Returns: Promise&lt;void&gt;

load()

Load a custom tool definition by name

typescript
load(userId: string | undefined, name: string): Promise&lt;CustomToolDefinition | null&gt;;

Parameters:

  • userId: string | undefined
  • name: string

Returns: Promise&lt;CustomToolDefinition | null&gt;

delete()

Delete a custom tool definition by name

typescript
delete(userId: string | undefined, name: string): Promise&lt;void&gt;;

Parameters:

  • userId: string | undefined
  • name: string

Returns: Promise&lt;void&gt;

exists()

Check if a custom tool exists

typescript
exists(userId: string | undefined, name: string): Promise&lt;boolean&gt;;

Parameters:

  • userId: string | undefined
  • name: string

Returns: Promise&lt;boolean&gt;

list()

List custom tools (summaries only)

typescript
list(userId: string | undefined, options?: CustomToolListOptions): Promise&lt;CustomToolSummary[]&gt;;

Parameters:

  • userId: string | undefined
  • options: CustomToolListOptions | undefined (optional)

Returns: Promise&lt;CustomToolSummary[]&gt;

updateMetadata()?

Update metadata without loading full definition

typescript
updateMetadata?(userId: string | undefined, name: string, metadata: Record&lt;string, unknown&gt;): Promise&lt;void&gt;;

Parameters:

  • userId: string | undefined
  • name: string
  • metadata: Record&lt;string, unknown&gt;

Returns: Promise&lt;void&gt;

getPath()

Get the storage path/location for a specific user (for display/debugging)

typescript
getPath(userId: string | undefined): string;

Parameters:

  • userId: string | undefined

Returns: string


IToolExecutionPipeline interface

📍 src/core/tool-execution/types.ts:160

Pipeline interface for managing and executing plugins.

Methods

use()

Register a plugin with the pipeline. If a plugin with the same name exists, it will be replaced.

typescript
use(plugin: IToolExecutionPlugin): this;

Parameters:

  • plugin: IToolExecutionPlugin

Returns: this

remove()

Remove a plugin by name.

typescript
remove(pluginName: string): boolean;

Parameters:

  • pluginName: string

Returns: boolean

has()

Check if a plugin is registered.

typescript
has(pluginName: string): boolean;

Parameters:

  • pluginName: string

Returns: boolean

get()

Get a registered plugin by name.

typescript
get(pluginName: string): IToolExecutionPlugin | undefined;

Parameters:

  • pluginName: string

Returns: IToolExecutionPlugin | undefined

list()

List all registered plugins (sorted by priority).

typescript
list(): IToolExecutionPlugin[];

Returns: IToolExecutionPlugin[]

execute()

Execute a tool through the plugin pipeline.

typescript
execute(tool: ToolFunction, args: unknown, options?: PipelineExecutionOptions): Promise&lt;unknown&gt;;

Parameters:

  • tool: ToolFunction&lt;any, any&gt;
  • args: unknown
  • options: PipelineExecutionOptions | undefined (optional)

Returns: Promise&lt;unknown&gt;


IToolExecutionPlugin interface

📍 src/core/tool-execution/types.ts:93

Plugin interface for extending tool execution.

Plugins can hook into the execution lifecycle to:

  • Modify arguments before execution
  • Transform results after execution
  • Handle errors
  • Emit side effects (logging, UI updates, analytics)

Example:

typescript
class MyPlugin implements IToolExecutionPlugin {
  readonly name = 'my-plugin';
  readonly priority = 100;

  async beforeExecute(ctx: PluginExecutionContext) {
    console.log(`Starting ${ctx.toolName}`);
  }

  async afterExecute(ctx: PluginExecutionContext, result: unknown) {
    console.log(`Finished ${ctx.toolName} in ${Date.now() - ctx.startTime}ms`);
    return result;
  }
}
Methods

beforeExecute()?

Called before tool execution.

Can:

  • Return void to continue with original args
  • Return { modifiedArgs } to continue with modified args
  • Return { abort: true, result } to short-circuit and return immediately
typescript
beforeExecute?(ctx: PluginExecutionContext): Promise&lt;BeforeExecuteResult&gt;;

Parameters:

  • ctx: PluginExecutionContext

Returns: Promise&lt;BeforeExecuteResult&gt;

afterExecute()?

Called after successful tool execution.

Can transform or replace the result. Must return the (possibly modified) result. Hooks run in reverse priority order for proper stack-like unwinding.

typescript
afterExecute?(ctx: PluginExecutionContext, result: unknown): Promise&lt;unknown&gt;;

Parameters:

  • ctx: PluginExecutionContext
  • result: unknown

Returns: Promise&lt;unknown&gt;

onError()?

Called when tool execution fails.

Can:

  • Return undefined to let error propagate to next plugin/caller
  • Return a value to recover from the error (returned as the result)
  • Throw a different error
typescript
onError?(ctx: PluginExecutionContext, error: Error): Promise&lt;unknown&gt;;

Parameters:

  • ctx: PluginExecutionContext
  • error: Error

Returns: Promise&lt;unknown&gt;

onRegister()?

Called when plugin is registered with a pipeline. Use for setup that requires pipeline reference.

typescript
onRegister?(pipeline: IToolExecutionPipeline): void;

Parameters:

  • pipeline: IToolExecutionPipeline

Returns: void

onUnregister()?

Called when plugin is unregistered from a pipeline. Use for cleanup.

typescript
onUnregister?(): void;

Returns: void

Properties
Property Type Description
name readonly name: string; Unique plugin name (used for registration and lookup)
priority? readonly priority?: number; Execution priority. Lower values run earlier in beforeExecute,
later in afterExecute (for proper unwinding).
Default: 100

IToolExecutor interface

📍 src/domain/interfaces/IToolExecutor.ts:7

Methods

execute()

Execute a tool function

typescript
execute(toolName: string, args: any): Promise&lt;any&gt;;

Parameters:

  • toolName: string
  • args: any

Returns: Promise&lt;any&gt;

hasToolFunction()

Check if tool is available

typescript
hasToolFunction(toolName: string): boolean;

Parameters:

  • toolName: string

Returns: boolean

getToolDefinition()

Get tool definition

typescript
getToolDefinition(toolName: string): Tool | undefined;

Parameters:

  • toolName: string

Returns: Tool | undefined

registerTool()

Register a new tool

typescript
registerTool(tool: ToolFunction): void;

Parameters:

  • tool: ToolFunction&lt;any, any&gt;

Returns: void

unregisterTool()

Unregister a tool

typescript
unregisterTool(toolName: string): void;

Parameters:

  • toolName: string

Returns: void

listTools()

List all registered tools

typescript
listTools(): string[];

Returns: string[]


IToolSnapshot interface

📍 src/core/context-nextgen/snapshot.ts:98

Snapshot of a single tool's registration state.

Properties
Property Type Description
name name: string; Tool name
description description: string; Tool description
enabled enabled: boolean; Whether the tool is currently enabled
callCount callCount: number; Number of times this tool has been called
namespace? namespace?: string; Tool namespace (if registered with one)

JSONSchema interface

📍 src/domain/entities/Tool.ts:12

Properties
Property Type Description
type type: string; -
properties? properties?: Record&lt;string, any&gt;; -
required? required?: string[]; -

MCPTool interface

📍 src/domain/entities/MCPTypes.ts:11

MCP Domain Types

Core types for MCP tools, resources, and prompts. These are simplified wrappers around the SDK types.

Properties
Property Type Description
name name: string; Tool name
description? description?: string; Tool description
inputSchema `inputSchema: {
type: 'object';
properties?: Record&lt;string, unknown&gt;;
required?: string[];
[key: string]: unknown;

};` | JSON Schema for tool input |


MCPToolResult interface

📍 src/domain/entities/MCPTypes.ts:28

MCP Tool call result

Properties
Property Type Description
content `content: Array<{
type: 'text' | 'image' | 'resource';
text?: string;
data?: string;
mimeType?: string;
uri?: string;

}>;| Result content | |isError?|isError?: boolean;` | Whether the tool call resulted in an error |


NativeToolEvent interface

📍 src/domain/entities/Response.ts:38

Properties
Property Type Description
capability capability: string; -
id? id?: string; -
call_id? call_id?: string; Stable call identifier to use when the host must return a tool result.
status? status?: string; -
phase? `phase?: 'call' 'output';`
details? details?: unknown; Provider-native call payload. Required for host-executed native tools.
error? error?: { code?: string; message: string; details?: unknown }; -

OpenAIRealtimeFunctionTool interface

📍 src/capabilities/voice/openai/RealtimeTypes.ts:64

Properties
Property Type Description
type type: 'function'; -
name name: string; -
description? description?: string; -
parameters? parameters?: Record&lt;string, unknown&gt;; -

OpenAIRealtimeMCPTool interface

📍 src/capabilities/voice/openai/RealtimeTypes.ts:71

Properties
Property Type Description
type type: 'mcp'; -
server_label server_label: string; -
server_url? server_url?: string; -
connector_id? connector_id?: string; -
authorization? authorization?: string; -
allowed_tools? `allowed_tools?: string[] { read_only?: boolean; tool_names?: string[] }
require_approval? `require_approval?: 'always' 'never'
always?: { read_only?: boolean; tool_names?: string[] };
never?: { read_only?: boolean; tool_names?: string[] };

} | null;| - | |defer_loading?|defer_loading?: boolean;| - | |headers?|headers?: Record<string, string> | null;| - | |server_description?|server_description?: string;` | - |


OrchestrationToolsContext interface

📍 src/core/orchestrator/tools.ts:23

Properties
Property Type Description
workspace workspace: SharedWorkspacePluginNextGen; Shared workspace plugin instance
agents agents: Map&lt;string, Agent&gt;; Live worker agent instances (name → Agent)
agentTypes agentTypes: Map&lt;string, AgentTypeConfig&gt;; Registered agent type configurations
lastTurnTimestamps lastTurnTimestamps: Map&lt;string, number&gt;; Timestamp of each agent's last completed turn (for workspace deltas)
createWorkerAgent createWorkerAgent: (name: string, type: string) =&gt; Agent; Factory function to create a worker agent
maxAgents? maxAgents?: number; Maximum number of worker agents (default: 20)
delegationState delegationState: DelegationState; Delegation state — shared with createOrchestrator for run()/stream() wrapping
delegationDefaults? delegationDefaults?: DelegationDefaults; Default delegation settings from OrchestratorConfig

OutcomeInvocation interface

📍 src/core/createOutcomeTool.ts:6

Invocation-local diagnostics, separate from the tool's application result.

Methods

reportFailure()

Report an operational failure. First report wins; inactive after callback settlement.

typescript
reportFailure(error: Error): void;

Parameters:

  • error: Error

Returns: void

Properties
Property Type Description
context `readonly context: ToolContext undefined;`

ParsedConnectorCategory interface

📍 src/core/ToolCatalogRegistry.ts:108

Parsed connector category: connector name + optional account alias.

Properties
Property Type Description
connectorName connectorName: string; Connector name (e.g., 'microsoft')
accountId? accountId?: string; Account alias (e.g., 'work') — undefined for single-account connectors

PendingAsyncTool interface

📍 src/domain/entities/Tool.ts:151

Tracks a single async tool execution in flight

Properties
Property Type Description
toolCallId toolCallId: string; -
toolName toolName: string; -
args args: Record&lt;string, unknown&gt;; -
startTime startTime: number; -
status status: PendingAsyncToolStatus; -
result? result?: ToolResult; -
error? error?: Error; -

PortableToolDescriptor interface

📍 src/portable/types.ts:32

Serializable tool metadata. Executable code is resolved by the receiving runtime.

Properties
Property Type Description
definition definition: FunctionToolDefinition; -
placement placement: PortableToolPlacement; -
permission? permission?: ToolPermissionConfig; Informational only. Hydration ignores this unless a trusted host resolves it.
implementationFingerprint implementationFingerprint: string; Local tools identify the executable selected by the trusted host; remote
tools carry a canonical definition fingerprint for wire consistency.
namespace? namespace?: string; -
category? category?: string; -
tags? tags?: string[]; -

RemoteToolError interface

📍 src/portable/types.ts:210

Properties
Property Type Description
code code: string; -
message message: string; -
retryable? retryable?: boolean; -

RemoteToolExecutionRequest interface

📍 src/portable/types.ts:202

Properties
Property Type Description
protocolVersion protocolVersion: AgentPackageProtocolVersion; -
packageId packageId: string; -
requestId requestId: string; -
toolName toolName: string; -
arguments arguments: Record&lt;string, unknown&gt;; -

RemoteToolTransport interface

📍 src/portable/types.ts:233

Host-supplied authenticated transport. OneRingAI owns the wire DTO and proxy tool behavior.

Methods

execute()

typescript
execute(
    request: RemoteToolExecutionRequest,
    options?: { signal?: AbortSignal },
  ): Promise&lt;RemoteToolExecutionResponse&gt;;

Parameters:

  • request: RemoteToolExecutionRequest
  • options: { signal?: AbortSignal | undefined; } | undefined (optional)

Returns: Promise&lt;RemoteToolExecutionResponse&gt;


RequestUserInputToolDisplayResult interface

📍 src/tools/interaction/requestUserInput.ts:99

Properties
Property Type Description
channel channel: string; Channel the prompt was delivered on.
correlationId correlationId: string; Correlation id used to resume the session (opaque to the LLM).
message message: string; Human-readable confirmation, e.g., "Slack DM to
suspended suspended: true; Whether the agent is now suspended (always true on success).

ResolvedLocalTool interface

📍 src/portable/types.ts:131

Properties
Property Type Description
tool tool: ToolFunction; -
implementationFingerprint implementationFingerprint: string; Must match the fingerprint selected by the exporting runtime.

RoutineToolCatalogOptions interface

📍 src/core/createRoutineTool.ts:55

Properties
Property Type Description
definitions definitions: RoutineDefinition[]; Routine definitions to register as a tool catalog category.
createAgent `createAgent: (definition: RoutineDefinition) => Agent Promise<Agent>;`
Called per-invocation; the agent is destroyed after the routine completes.
categoryName? categoryName?: string; Category name for ToolCatalogRegistry. Default: 'routines:executable'
categoryDisplayName? categoryDisplayName?: string; Category display name. Default: 'Executable Routines'

RoutineToolOptions interface

📍 src/core/routines/types.ts:84

Methods

createAgent()

typescript
createAgent(): Agent | Promise&lt;Agent&gt;;

Returns: Agent | Promise&lt;Agent&gt;

resolveExecution()?

typescript
resolveExecution?(args: Record&lt;string, unknown&gt;, context: ToolContext | undefined): ExecutionBinding;

Parameters:

  • args: Record&lt;string, unknown&gt;
  • context: ToolContext | undefined

Returns: ExecutionBinding

Properties
Property Type Description
definition definition: RoutineDefinition; -
toolName toolName: string; -

RoutineToolResult interface

📍 src/core/routines/types.ts:90

Properties
Property Type Description
operationId operationId: string; -
state state: RoutineRunResult['state']; -
omittedReferences? omittedReferences?: number; More references remain in the host source index.
references references: readonly EvidenceReference[]; -

SerializedToolState interface

📍 src/core/ToolManager.ts:184

Properties
Property Type Description
enabled enabled: Record&lt;string, boolean&gt;; -
namespaces namespaces: Record&lt;string, string&gt;; -
priorities priorities: Record&lt;string, number&gt;; -
permissions? permissions?: Record&lt;string, ToolPermissionConfig&gt;; Permission configs by tool name
tags? tags?: Record&lt;string, string[]&gt;; Tags by tool name
categories? categories?: Record&lt;string, string&gt;; Categories by tool name
sources? sources?: Record&lt;string, ToolSource&gt;; Sources by tool name

ServiceToolFactoryOptions interface

📍 src/tools/connector/ConnectorTools.ts:114

Options forwarded from ConnectorTools.for() to a ServiceToolFactory.

Currently carries the optional actAs lock. Adding new fields here is a non-breaking change because the options parameter is itself optional and existing factories that ignore extra params continue to work.

Properties
Property Type Description
actAs? actAs?: string; Lock the on-behalf-of user identity for tools that act as a specific user
(Microsoft Graph /users/{id}, Google API userId). Set ONCE at tool
instantiation; the LLM cannot override it at call time.
  • When set: the per-tool targetUser schema parameter is OMITTED and this value is always used.
  • When unset: existing behavior (LLM supplies targetUser for app-only auth).
  • Silently ignored for delegated connectors (identity already bound by token). |

ShellToolConfig interface

📍 src/tools/shell/types.ts:10

Shell Tools - Shared Types

Common types and configuration for shell command execution.

Properties
Property Type Description
workingDirectory? workingDirectory?: string; Working directory for command execution.
Defaults to process.cwd()
defaultTimeout? defaultTimeout?: number; Default timeout for commands in milliseconds.
Default: 120000 (2 minutes)
maxTimeout? maxTimeout?: number; Maximum timeout allowed in milliseconds.
Default: 600000 (10 minutes)
shell? shell?: string; Shell to use for command execution.
Default: '/bin/bash' on Unix, 'cmd.exe' on Windows
env? env?: Record&lt;string, string&gt;; Environment variables to add to command execution.
blockedCommands? blockedCommands?: string[]; Commands that are blocked from execution.
Default: dangerous commands like rm -rf /
blockedPatterns? blockedPatterns?: RegExp[]; Patterns that if matched will block the command.
Default: patterns that could cause data loss
maxOutputSize? maxOutputSize?: number; Soft ceiling on in-memory output buffer per command, in characters.
Purely a process-memory safeguard — the bash tool uses a rolling tail
buffer so a runaway command that writes gigabytes cannot OOM the host.
The FULL buffer up to this ceiling is returned to the caller verbatim
(no head-clip). Default: 10_000_000 (10MB), which fits a typical LLM's
context window many times over and only kicks in on genuinely runaway
commands. Lower only if you have tight memory constraints.
allowBackground? allowBackground?: boolean; Whether to allow running commands in background.
Default: true

ToolCall interface

📍 src/domain/entities/Tool.ts:73

Properties
Property Type Description
id id: string; -
type type: 'function'; -
function `function: {
name: string;
arguments: string; // JSON string

};| - | |async?|async?: boolean;| Whether the provider marked this as an async protocol call. | |blocking|blocking: boolean;| - | |state|state: ToolCallState;| - | |startTime?|startTime?: Date;| - | |endTime?|endTime?: Date;| - | |error?|error?: string;` | - |


ToolCallArgumentsDeltaEvent interface

📍 src/domain/entities/StreamEvent.ts:106

Tool call arguments delta - incremental JSON

Properties
Property Type Description
type type: StreamEventType.TOOL_CALL_ARGUMENTS_DELTA; -
item_id item_id: string; -
tool_call_id tool_call_id: string; -
tool_name tool_name: string; -
delta delta: string; -
sequence_number sequence_number: number; -

ToolCallArgumentsDoneEvent interface

📍 src/domain/entities/StreamEvent.ts:118

Tool call arguments complete

Properties
Property Type Description
type type: StreamEventType.TOOL_CALL_ARGUMENTS_DONE; -
tool_call_id tool_call_id: string; -
tool_name tool_name: string; -
arguments arguments: string; -
tool_type? `tool_type?: 'function' 'custom';`
async? async?: boolean; -
incomplete? incomplete?: boolean; -

ToolCallBuffer interface

📍 src/domain/entities/StreamState.ts:14

Buffer for accumulating tool call arguments

Properties
Property Type Description
toolName toolName: string; -
argumentChunks argumentChunks: string[]; -
isComplete isComplete: boolean; -
startTime startTime: Date; -
toolType? `toolType?: 'function' 'custom';`
async? async?: boolean; -

ToolCallBuffer interface

📍 src/infrastructure/providers/base/BaseStreamConverter.ts:19

Buffer for accumulating tool call arguments during streaming

Properties
Property Type Description
id id: string; -
name name: string; -
args args: string; -

ToolCallStartEvent interface

📍 src/domain/entities/StreamEvent.ts:87

Tool call detected and starting

Properties
Property Type Description
type type: StreamEventType.TOOL_CALL_START; -
item_id item_id: string; -
output_index? output_index?: number; Provider output position, used to replay mixed text/tool/reasoning output exactly.
sequence_number? sequence_number?: number; -
tool_call_id tool_call_id: string; -
tool_name tool_name: string; -
tool_type? `tool_type?: 'function' 'custom';`
async? async?: boolean; Whether the provider allows the model to continue while the host runs the tool.
thought_signature? thought_signature?: string; Google Gemini 3+ thought signature for round-tripping function calls

ToolCatalogPluginConfig interface

📍 src/core/context-nextgen/plugins/ToolCatalogPluginNextGen.ts:49

Properties
Property Type Description
categoryScope? categoryScope?: ToolCategoryScope; Scope filter for which built-in categories are visible (does NOT affect connector categories)
autoLoadCategories? autoLoadCategories?: string[]; Categories to pre-load on initialization (can be unloaded by LLM)
pinned? pinned?: string[]; Categories that are always loaded and cannot be unloaded by the LLM
maxLoadedCategories? maxLoadedCategories?: number; Maximum loaded categories at once, excluding pinned (default: 10)
identities? identities?: AuthIdentity[]; Auth identities for connector category filtering

ToolCategoryDefinition interface

📍 src/core/ToolCatalogRegistry.ts:40

Definition of a tool category in the catalog.

Properties
Property Type Description
name name: string; Unique category name (e.g., 'filesystem', 'knowledge', 'connector:github')
displayName displayName: string; Human-readable display name (e.g., 'File System')
description description: string; Description shown in catalog metatool display

ToolCondition interface

📍 src/core/ToolManager.ts:125

Properties
Property Type Description
type `type: 'mode' 'context'
predicate predicate: (context: ToolSelectionContext) =&gt; boolean; -

ToolContext interface

📍 src/domain/interfaces/IToolContext.ts:73

Context passed to tool execute function

Simple and clean - only what tools actually need.

Properties
Property Type Description
agentId? agentId?: string; Agent ID (for logging/tracing)
taskId? taskId?: string; Task ID (if running in TaskAgent)
userId? userId?: string; User ID — auto-populated from Agent config (userId). Also settable manually via agent.tools.setToolContext().
timeZone? timeZone?: string; Viewer's IANA timezone (e.g. 'America/New_York') — auto-populated from
Agent config (timezone). When present, tools that surface instants
SHOULD render them as wall-clock time in this zone so the model never has
to convert from UTC. When absent, tools return times as stored (UTC). The
library never infers this from entity metadata — the host supplies it.
accountId? accountId?: string; Account alias for multi-account OAuth — auto-populated from Agent config (accountId). Allows one user to auth multiple external accounts on the same connector (e.g., 'work', 'personal').
connectorAccounts? connectorAccounts?: Record&lt;string, string&gt;; Per-connector account bindings (connector name → accountId).

Set by the host app during tool resolution for single-account connectors. Connector tools resolve their accountId from this map when accountId is not explicitly set (i.e., the tool is not wrapped with withAccountBinding).

Resolution order in connector tools:

  1. context.accountId — explicit per-tool binding (multi-account wrapper)
  2. context.connectorAccounts[connectorName] — per-connector binding (this field)
  3. undefined — no binding (legacy tokens without accountId) | | identities? | identities?: AuthIdentity[]; | Auth identities this agent is scoped to (for identity-aware tool descriptions) | | connectorRegistry? | connectorRegistry?: IConnectorRegistry; | Connector registry scoped to this agent's allowed connectors and userId | | roles? | roles?: string[]; | User roles for permission policy evaluation | | sessionId? | sessionId?: string; | Session ID for approval cache scoping | | memory? | memory?: WorkingMemoryAccess; | Working memory access (if agent has memory feature enabled) | | signal? | signal?: AbortSignal; | Abort signal for cancellation |

ToolEvidenceConfig interface

📍 src/core/evidence/ToolEvidenceMiddleware.ts:14

Properties
Property Type Description
storage storage: IEvidenceStorage; -
projectThresholdBytes? projectThresholdBytes?: number; Only hinted tools with summarize() and results at least this large are projected. Default 8192 bytes.
maxSummaryChars? maxSummaryChars?: number; Summary cap, default 2000 characters; an oversized summary falls back to raw.
maxProjectionChars? maxProjectionChars?: number; Whole model-facing envelope cap, default 4096 characters.
writeTimeoutMs? writeTimeoutMs?: number; Deadline for acknowledgement; default 5000ms. Late writes do not authorize projection.
retentionMs? retentionMs?: number; -
maxSerializationBytes? maxSerializationBytes?: number; Optional pre-storage UTF-8 serialization cap; inherits storage.serializationLimitBytes when available.
Custom stores without a hint retain their own capacity policy unless this option is supplied.
redact? `redact?: (value: unknown, kind: 'arguments' 'result') => unknown;`

ToolEvidenceDelivery interface

📍 src/core/evidence/ToolEvidenceMiddleware.ts:13

Projection belongs only to the managed prompt view. Raw returns/events stay raw.

Properties
Property Type Description
projection? projection?: string -

ToolEvidenceReceipt interface

📍 src/core/evidence/ToolEvidenceMiddleware.ts:6

Metadata is diagnostic; storage/projection failures never change tool-effect status.

Properties
Property Type Description
status `status: 'stored' 'storage_failed'
reference? reference?: EvidenceReference; -
effect `effect: 'read' 'write'
errorCode? errorCode?: string; -

ToolExecutionContext interface

📍 src/domain/entities/Tool.ts:108

Tool execution context - tracks all tool calls in a generation

Properties
Property Type Description
executionId executionId: string; -
toolCalls toolCalls: Map&lt;string, ToolCall&gt;; -
pendingNonBlocking pendingNonBlocking: Set&lt;string&gt;; -
completedResults completedResults: Map&lt;string, ToolResult&gt;; -

ToolExecutionDoneEvent interface

📍 src/domain/entities/StreamEvent.ts:141

Tool execution complete

Properties
Property Type Description
outcome? outcome?: import('./Tool.js').ToolExecutionOutcome; Additive semantic metadata; raw content retains its existing shape.
type type: StreamEventType.TOOL_EXECUTION_DONE; -
tool_call_id tool_call_id: string; -
tool_name tool_name: string; -
result result: any; -
execution_time_ms execution_time_ms: number; -
error? error?: string; -

ToolExecutionOptions interface

📍 src/domain/entities/Tool.ts:400

Additive options for a single ToolManager invocation. Zero disables the additional per-call deadline.

Properties
Property Type Description
signal? signal?: AbortSignal; -
timeoutMs? timeoutMs?: number; -
callId? callId?: string; -
runId? runId?: string; -
onOutcome? onOutcome?: (outcome: ToolExecutionOutcome) =&gt; void; Host observer for the initial outcome; exceptions do not affect execution.
onEvidence? onEvidence?: (evidence: ToolEvidenceDelivery) =&gt; void; Host observer for opt-in evidence delivery; exceptions are isolated.

ToolExecutionOutcome interface

📍 src/domain/entities/Tool.ts:382

Semantic execution metadata. It never asserts that a remote side effect was undone.

Properties
Property Type Description
executionId executionId: string; -
toolName toolName: string; -
callId? callId?: string; -
runId? runId?: string; -
status `status: 'succeeded' 'failed'
startedAt startedAt: number; -
durationMs durationMs: number; -
timeoutMs? timeoutMs?: number; -
executionStarted executionStarted: boolean; -
completion `completion: 'settled' 'unknown'
cancellation `cancellation: 'none' 'requested'
error? error?: string; -
evidence? evidence?: ToolEvidenceReceipt; Opt-in storage diagnostics; never changes the execution status.

ToolExecutionPipelineOptions interface

📍 src/core/tool-execution/types.ts:210

Options for creating a ToolExecutionPipeline

Properties
Property Type Description
useRandomUUID? useRandomUUID?: boolean; Whether to generate unique execution IDs using crypto.randomUUID().
If false, uses a simpler counter-based ID.
Default: true (if crypto.randomUUID is available)

ToolExecutionReport interface

📍 src/domain/entities/Tool.ts:411

Properties
Property Type Description
result result: T; -
outcome outcome: ToolExecutionOutcome; -
evidence? evidence?: ToolEvidenceDelivery; -

ToolExecutionStartEvent interface

📍 src/domain/entities/StreamEvent.ts:131

Tool execution starting

Properties
Property Type Description
type type: StreamEventType.TOOL_EXECUTION_START; -
tool_call_id tool_call_id: string; -
tool_name tool_name: string; -
arguments arguments: any; -

ToolFunction interface

📍 src/domain/entities/Tool.ts:239

User-provided tool function

Properties
Property Type Description
definition definition: FunctionToolDefinition; -
execute execute: (args: TArgs, context?: ToolContext) =&gt; Promise&lt;TResult&gt;; -
idempotency? idempotency?: ToolIdempotency; -
output? output?: ToolOutputHints; -
permission? permission?: ToolPermissionConfig; Permission settings for this tool. If not set, defaults are used.
descriptionFactory? descriptionFactory?: (context?: ToolContext) =&gt; string; Dynamic description generator for the tool.
If provided, this function is called when tool definitions are serialized for the LLM,
allowing the description to reflect current state (e.g., available connectors).

The returned string replaces definition.function.description when sending to LLM. The static description in definition.function.description serves as a fallback. | | describeCall? | describeCall?: (args: TArgs) =&gt; string; | Returns a human-readable description of a tool call. Used for logging, UI display, and debugging. | | connectorName? | connectorName?: string; | Connector this tool was generated from (set by ConnectorTools.for()). | | connectorAccountId? | connectorAccountId?: string; | Account alias this tool is bound to (set by ConnectorTools.for() with accountId). |


ToolManagerConfig interface

📍 src/core/ToolManager.ts:232

Configuration for ToolManager

Properties
Property Type Description
toolExecutionTimeout? toolExecutionTimeout?: number; Hard timeout in milliseconds for any single tool execution.
Acts as a safety net: if a tool's own timeout mechanism fails
(e.g. child process doesn't exit), this will force-resolve with an error.
Default: 0 (disabled - relies on tool's own timeout)

ToolManagerStats interface

📍 src/core/ToolManager.ts:174

Properties
Property Type Description
totalTools totalTools: number; -
enabledTools enabledTools: number; -
disabledTools disabledTools: number; -
namespaces namespaces: string[]; -
toolsByNamespace toolsByNamespace: Record&lt;string, number&gt;; -
mostUsed mostUsed: Array&lt;{ name: string; count: number }&gt;; -
totalExecutions totalExecutions: number; -

ToolMetadata interface

📍 src/core/ToolManager.ts:164

Properties
Property Type Description
registeredAt registeredAt: Date; -
usageCount usageCount: number; -
lastUsed? lastUsed?: Date; -
totalExecutionMs totalExecutionMs: number; -
avgExecutionMs avgExecutionMs: number; -
successCount successCount: number; -
failureCount failureCount: number; -

ToolModification interface

📍 src/capabilities/agents/types/HookTypes.ts:101

Properties
Property Type Description
modified? modified?: Partial&lt;ToolCall&gt;; -
skip? skip?: boolean; -
mockResult? mockResult?: any; -
reason? reason?: string; -

ToolOptions interface

📍 src/core/ToolManager.ts:106

Properties
Property Type Description
enabled? enabled?: boolean; Whether the tool is enabled. Default: true
namespace? namespace?: string; Namespace for grouping related tools. Default: 'default'
priority? priority?: number; Priority for selection ordering. Higher = preferred. Default: 0
conditions? conditions?: ToolCondition[]; Conditions for auto-enable/disable
permission? permission?: ToolPermissionConfig; Permission configuration override. If not set, uses tool's config or defaults.
tags? tags?: string[]; Tags for categorization and search
category? category?: string; Category grouping
source? source?: ToolSource; Source identifier (built-in, connector, custom, mcp, etc.)

ToolOutputHints interface

📍 src/domain/entities/Tool.ts:167

Output handling hints for context management

Properties
Property Type Description
expectedSize? `expectedSize?: 'small' 'medium'
summarize? summarize?: (output: unknown) =&gt; string; -
effect? `effect?: 'read' 'write'

ToolPermissionConfig interface

📍 src/core/permissions/types.ts:45

Permission configuration for a tool

Can be set on the tool definition or overridden at registration time.

Properties
Property Type Description
scope? scope?: PermissionScope; When approval is required.
riskLevel? riskLevel?: RiskLevel; Risk classification for the tool.
approvalMessage? approvalMessage?: string; Custom message shown in approval UI.
Should explain what the tool does and any potential risks.
sensitiveArgs? sensitiveArgs?: string[]; Argument names that should be highlighted in approval UI.
E.g., ['path', 'url'] for file/network operations.
sessionTTLMs? sessionTTLMs?: number; Optional expiration time for session approvals (milliseconds).
If set, session approvals expire after this duration.

ToolPermissionConfig interface

📍 src/domain/entities/Tool.ts:203

Permission configuration for a tool

Controls when approval is required for tool execution. Used by the ToolPermissionManager.

Properties
Property Type Description
scope? `scope?: 'once' 'session'
  • 'once' - Require approval for each call
  • 'session' - Approve once per session
  • 'always' - Auto-approve (no prompts)
  • 'never' - Always blocked | | riskLevel? | riskLevel?: 'low' | 'medium' | 'high' | 'critical'; | Risk level classification. | | approvalMessage? | approvalMessage?: string; | Custom message shown in approval UI. | | sensitiveArgs? | sensitiveArgs?: string[]; | Argument names that should be highlighted as sensitive. | | sessionTTLMs? | sessionTTLMs?: number; | TTL for session approvals (milliseconds). |

ToolRegistration interface

📍 src/core/ToolManager.ts:145

Properties
Property Type Description
tool tool: ToolFunction; -
enabled enabled: boolean; -
namespace namespace: string; -
priority priority: number; -
conditions conditions: ToolCondition[]; -
metadata metadata: ToolMetadata; -
permission? permission?: ToolPermissionConfig; Effective permission config (merged from tool.permission and options.permission)
circuitBreakerConfig? circuitBreakerConfig?: Partial&lt;CircuitBreakerConfig&gt;; Circuit breaker configuration for this tool (uses shared CircuitBreakerConfig from resilience)
tags? tags?: string[]; Tags for categorization and search
category? category?: string; Category grouping
source? source?: ToolSource; Source identifier (built-in, connector, custom, mcp, etc.)

ToolRegistryEntry interface

📍 src/core/ToolCatalogRegistry.ts:81

Entry format from the generated tool registry (registry.generated.ts). Used by initializeFromRegistry() and registerFromToolRegistry().

Properties
Property Type Description
name name: string; -
displayName displayName: string; -
category category: string; -
description description: string; -
tool tool: ToolFunction; -
safeByDefault safeByDefault: boolean; -
requiresConnector? requiresConnector?: boolean; -

ToolRegistryEntry interface

📍 src/tools/registry.generated.ts:55

Metadata for a tool in the registry

Properties
Property Type Description
name name: string; Tool name (matches definition.function.name)
exportName exportName: string; Export variable name
displayName displayName: string; Human-readable display name
category category: ToolCategory; Category for grouping
description description: string; Brief description
tool tool: ToolFunction; The actual tool function
safeByDefault safeByDefault: boolean; Whether this tool is safe without explicit approval
implementationHash? implementationHash?: string; SHA-256 fingerprint of the tool source and its OneRingAI runtime source.
requiresConnector? requiresConnector?: boolean; Whether this tool requires a connector
connectorServiceTypes? connectorServiceTypes?: string[]; Supported connector service types (if requiresConnector)

ToolResult interface

📍 src/domain/entities/Tool.ts:89

Properties
Property Type Description
pending? pending?: boolean; Async acceptance placeholder, not evidence of successful completion.
outcome? outcome?: ToolExecutionOutcome; Additive semantic metadata; raw content retains its existing shape.
evidence? evidence?: ToolEvidenceDelivery; Framework-owned projection; content and application events retain raw results.
tool_use_id tool_use_id: string; -
tool_name? tool_name?: string; -
tool_args? tool_args?: Record&lt;string, unknown&gt;; -
content content: any; -
error? error?: string; -
executionTime? executionTime?: number; -
state state: ToolCallState; -

ToolResultContent interface

📍 src/domain/entities/Content.ts:85

Properties
Property Type Description
evidence? evidence?: ToolResultEvidence; -
type type: ContentType.TOOL_RESULT; -
tool_use_id tool_use_id: string; -
content `content: string any;`
error? error?: string; -
__images? __images?: Array&lt;{ base64: string; mediaType: string }&gt;; Images extracted from tool results via the __images convention.
Stored separately from content so they don't inflate text-based token counts.
Provider converters read this field to inject native multimodal image blocks.

ToolResultEvidence interface

📍 src/domain/entities/Content.ts:70

Versioned optional persistence metadata. Failed acknowledgement protects the raw result from compaction.

Properties
Property Type Description
version version: 1; -
executionId? executionId?: string; -
status `status: 'stored' 'storage_failed'
reference? reference?: EvidenceReference; -

ToolSearchOutputItem interface

📍 src/domain/entities/Message.ts:118

Tool definitions returned by a client-executed OpenAI tool-search call.

Properties
Property Type Description
type type: 'tool_search_output'; -
call_id call_id: string; -
execution execution: 'client'; -
tools tools: Array&lt;Record&lt;string, unknown&gt;&gt;; -
status? `status?: 'in_progress' 'completed'

ToolSelectionContext interface

📍 src/core/ToolManager.ts:130

Properties
Property Type Description
input? input?: string; Current user input or task description
mode? mode?: string; Current agent mode (for UniversalAgent)
currentTask? currentTask?: string; Current task name (for TaskAgent)
recentTools? recentTools?: string[]; Recently used tools (to avoid repetition)
tokenBudget? tokenBudget?: number; Token budget for tool definitions
custom? custom?: Record&lt;string, unknown&gt;; Custom context data

ToolUseContent interface

📍 src/domain/entities/Content.ts:49

Properties
Property Type Description
type type: ContentType.TOOL_USE; -
id id: string; -
name name: string; -
arguments arguments: string; -
async? async?: boolean; Whether the provider marked this as an async protocol call.
thoughtSignature? thoughtSignature?: string; Google Gemini 3+ opaque thought signature for round-tripping function calls

ToolCallState enum

📍 src/domain/entities/Tool.ts:65

Properties
Property Type Description
PENDING pending -
EXECUTING executing -
COMPLETED completed -
FAILED failed -
TIMEOUT timeout -

DefaultAllowlistedTool type

📍 src/core/permissions/types.ts:374

Type for default allowlisted tools

typescript
type DefaultAllowlistedTool = (typeof DEFAULT_ALLOWLIST)[number]

DesktopToolName type

📍 src/tools/desktop/types.ts:281

typescript
type DesktopToolName = (typeof DESKTOP_TOOL_NAMES)[number]

LocalToolResolver type

📍 src/portable/types.ts:137

typescript
type LocalToolResolver = (
  descriptor: PortableToolDescriptor,
) =&gt; ResolvedLocalTool | undefined | Promise&lt;ResolvedLocalTool | undefined&gt;

NativeToolCapability type

📍 src/domain/interfaces/IAdvancedInference.ts:31

typescript
type NativeToolCapability = | 'web_search'
  | 'x_search'
  | 'web_fetch'
  | 'code_execution'
  | 'file_search'
  | 'remote_mcp'
  | 'computer_use'
  | 'hosted_shell'
  | 'apply_patch'
  | 'tool_search'
  | 'image_generation'

NativeToolRequest type

📍 src/domain/interfaces/IAdvancedInference.ts:78

typescript
type NativeToolRequest = | { capability: 'web_search'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'x_search'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'web_fetch'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'code_execution'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'file_search'; options: FileSearchOptions }
  | { capability: 'remote_mcp'; server: RemoteMcpDescriptor; options?: Record&lt;string, unknown&gt; }
  | { capability: 'computer_use'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'hosted_shell'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'apply_patch'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'tool_search'; options?: Record&lt;string, unknown&gt; }
  | { capability: 'image_generation'; options?: Record&lt;string, unknown&gt; }

OpenAIRealtimeTool type

📍 src/capabilities/voice/openai/RealtimeTypes.ts:87

typescript
type OpenAIRealtimeTool = OpenAIRealtimeFunctionTool | OpenAIRealtimeMCPTool

OutcomeToolOptions type

📍 src/core/createOutcomeTool.ts:13

All ordinary tool options, with an explicitly selected invocation callback.

typescript
type OutcomeToolOptions = Omit&lt;ToolFunction&lt;TArgs, TResult&gt;, 'execute'&gt; & {
  execute: (args: TArgs, invocation: OutcomeInvocation) =&gt; Promise&lt;TResult&gt;;
}

PendingAsyncToolStatus type

📍 src/domain/entities/Tool.ts:146

Status of a pending async tool execution

typescript
type PendingAsyncToolStatus = 'running' | 'completed' | 'failed' | 'timeout' | 'cancelled'

PortableToolPermissionResolver type

📍 src/portable/types.ts:141

typescript
type PortableToolPermissionResolver = (
  descriptor: PortableToolDescriptor,
) =&gt; ToolPermissionConfig | undefined

PortableToolPlacement type

📍 src/portable/types.ts:18

typescript
type PortableToolPlacement = 'local' | 'remote'

PortableToolPlacementResolver type

📍 src/portable/types.ts:88

typescript
type PortableToolPlacementResolver = (
  toolName: string,
  definition: FunctionToolDefinition,
) =&gt; PortableToolPlacement | 'omit'

RemoteToolExecutionResponse type

📍 src/portable/types.ts:216

typescript
type RemoteToolExecutionResponse = | {
      protocolVersion: AgentPackageProtocolVersion;
      packageId: string;
      requestId: string;
      ok: true;
      result: unknown;
    }
  | {
      protocolVersion: AgentPackageProtocolVersion;
      packageId: string;
      requestId: string;
      ok: false;
      error: RemoteToolError;
    }

ServiceToolFactory type

📍 src/tools/connector/ConnectorTools.ts:139

Factory function type for creating service-specific tools. Takes a Connector and returns an array of tools that use it.

The userId parameter is a legacy fallback — tools should prefer reading userId from ToolContext at execution time (auto-populated by Agent). Factory userId is used as fallback when ToolContext is not available.

The optional options parameter carries forwarded settings such as actAs. Existing factories that ignore the third argument continue to work.

typescript
type ServiceToolFactory = (
  connector: Connector,
  userId?: string,
  options?: ServiceToolFactoryOptions,
) =&gt; ToolFunction[]

Tool type

📍 src/domain/entities/Tool.ts:63

typescript
type Tool = FunctionToolDefinition | FreeformToolDefinition | BuiltInTool

ToolCallOutputContent type

📍 src/domain/entities/Message.ts:59

Top-level function result item for Responses continuations.

typescript
type ToolCallOutputContent = InputTextContent | InputImageContent | InputFileContent

ToolCategory type

📍 src/tools/registry.generated.ts:52

Tool category for grouping

typescript
type ToolCategory = 'filesystem' | 'shell' | 'web' | 'code' | 'json' | 'connector' | 'desktop' | 'custom-tools' | 'routines' | 'other'

ToolCategoryScope type

📍 src/core/ToolCatalogRegistry.ts:99

Scope for filtering which categories are visible/allowed.

  • string[] — shorthand allowlist (only these categories)
  • { include: string[] } — explicit allowlist
  • { exclude: string[] } — blocklist (all except these)
  • undefined — all categories allowed
typescript
type ToolCategoryScope = | string[]                  // shorthand allowlist
  | { include: string[] }     // explicit allowlist
  | { exclude: string[] }

ToolManagerEvent type

📍 src/core/ToolManager.ts:198

typescript
type ToolManagerEvent = | 'tool:registered'
  | 'tool:unregistered'
  | 'tool:enabled'
  | 'tool:disabled'
  | 'tool:executed'
  | 'tool:outcome'
  | 'tool:late-complete'
  | 'namespace:enabled'
  | 'namespace:disabled'

ToolSource type

📍 src/core/ToolManager.ts:62

Source identifier for a registered tool

typescript
type ToolSource = 'built-in' | 'connector' | 'custom' | 'mcp' | string

buildOrchestrationTools function

📍 src/core/orchestrator/tools.ts:170

typescript
export function buildOrchestrationTools(ctx: OrchestrationToolsContext): ToolFunction[]

createAddReactionTool function

📍 src/tools/slack/addReaction.ts:27

typescript
export function createAddReactionTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;AddReactionArgs, SlackAddReactionResult&gt;

createAgentPackageOutcomeTools function

📍 src/portable/OutcomeClient.ts:247

typescript
export async function createAgentPackageOutcomeTools(input: OutcomeAgentPackage, options: AgentPackageOutcomeToolOptions): Promise&lt;AgentPackageOutcomeTools&gt;

createBashTool function

📍 src/tools/shell/bash.ts:46

Create a Bash tool with the given configuration

typescript
export function createBashTool(config: ShellToolConfig = {}): ToolFunction&lt;BashArgs, BashResult&gt;

createCreatePRTool function

📍 src/tools/github/createPR.ts:46

Create a GitHub create_pr tool

typescript
export function createCreatePRTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;CreatePRArgs, GitHubCreatePRResult&gt;

createCustomToolDelete function

📍 src/tools/custom-tools/customToolDelete.ts:20

typescript
export function createCustomToolDelete(storage?: ICustomToolStorage): ToolFunction&lt;DeleteArgs, DeleteResult&gt;

createCustomToolDraft function

📍 src/tools/custom-tools/customToolDraft.ts:43

typescript
export function createCustomToolDraft(): ToolFunction&lt;DraftArgs, DraftResult&gt;

createCustomToolList function

📍 src/tools/custom-tools/customToolList.ts:24

typescript
export function createCustomToolList(storage?: ICustomToolStorage): ToolFunction&lt;ListArgs, ListResult&gt;

createCustomToolLoad function

📍 src/tools/custom-tools/customToolLoad.ts:21

typescript
export function createCustomToolLoad(storage?: ICustomToolStorage): ToolFunction&lt;LoadArgs, LoadResult&gt;

createCustomToolMetaTools function

📍 src/tools/custom-tools/factories.ts:37

Create all 6 custom tool meta-tools as an array.

typescript
export function createCustomToolMetaTools(options?: CustomToolMetaToolsOptions): ToolFunction[]

Example:

typescript
const agent = Agent.create({
  connector: 'openai',
  model: 'gpt-4',
  tools: [
    ...createCustomToolMetaTools(),
    ...otherTools,
  ],
});

createCustomToolSave function

📍 src/tools/custom-tools/customToolSave.ts:32

typescript
export function createCustomToolSave(storage?: ICustomToolStorage): ToolFunction&lt;SaveArgs, SaveResult&gt;

createCustomToolTest function

📍 src/tools/custom-tools/customToolTest.ts:32

typescript
export function createCustomToolTest(): ToolFunction&lt;TestArgs, TestResult&gt;

createDesktopGetCursorTool function

📍 src/tools/desktop/getCursor.ts:12

typescript
export function createDesktopGetCursorTool(config?: DesktopToolConfig): ToolFunction&lt;Record&lt;string, never&gt;, DesktopGetCursorResult&gt;

createDesktopGetScreenSizeTool function

📍 src/tools/desktop/getScreenSize.ts:11

typescript
export function createDesktopGetScreenSizeTool(config?: DesktopToolConfig): ToolFunction&lt;Record&lt;string, never&gt;, DesktopGetScreenSizeResult&gt;

createDesktopKeyboardKeyTool function

📍 src/tools/desktop/keyboardKey.ts:12

typescript
export function createDesktopKeyboardKeyTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopKeyboardKeyArgs, DesktopKeyboardKeyResult&gt;

createDesktopKeyboardTypeTool function

📍 src/tools/desktop/keyboardType.ts:12

typescript
export function createDesktopKeyboardTypeTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopKeyboardTypeArgs, DesktopKeyboardTypeResult&gt;

createDesktopMouseClickTool function

📍 src/tools/desktop/mouseClick.ts:13

typescript
export function createDesktopMouseClickTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopMouseClickArgs, DesktopMouseClickResult&gt;

createDesktopMouseDragTool function

📍 src/tools/desktop/mouseDrag.ts:12

typescript
export function createDesktopMouseDragTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopMouseDragArgs, DesktopMouseDragResult&gt;

createDesktopMouseMoveTool function

📍 src/tools/desktop/mouseMove.ts:13

typescript
export function createDesktopMouseMoveTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopMouseMoveArgs, DesktopMouseMoveResult&gt;

createDesktopMouseScrollTool function

📍 src/tools/desktop/mouseScroll.ts:12

typescript
export function createDesktopMouseScrollTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopMouseScrollArgs, DesktopMouseScrollResult&gt;

createDesktopScreenshotTool function

📍 src/tools/desktop/screenshot.ts:12

typescript
export function createDesktopScreenshotTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopScreenshotArgs, DesktopScreenshotResult&gt;

createDesktopWindowFocusTool function

📍 src/tools/desktop/windowFocus.ts:11

typescript
export function createDesktopWindowFocusTool(config?: DesktopToolConfig): ToolFunction&lt;DesktopWindowFocusArgs, DesktopWindowFocusResult&gt;

createDesktopWindowListTool function

📍 src/tools/desktop/windowList.ts:11

typescript
export function createDesktopWindowListTool(config?: DesktopToolConfig): ToolFunction&lt;Record&lt;string, never&gt;, DesktopWindowListResult&gt;

createDraftEmailTool function

📍 src/tools/microsoft/createDraftEmail.ts:36

Create a Microsoft Graph create_draft_email tool

typescript
export function createDraftEmailTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;CreateDraftEmailArgs, MicrosoftDraftEmailResult&gt;

createEditFileTool function

📍 src/tools/filesystem/editFile.ts:42

Create an Edit File tool with the given configuration

typescript
export function createEditFileTool(config: FilesystemToolConfig = {}): ToolFunction&lt;EditFileArgs, EditFileResult&gt;

createEditMeetingTool function

📍 src/tools/microsoft/editMeeting.ts:39

Create a Microsoft Graph edit_meeting tool

typescript
export function createEditMeetingTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;EditMeetingArgs, MicrosoftEditMeetingResult&gt;

createExecuteJavaScriptTool function

📍 src/tools/code/executeJavaScript.ts:258

Create an execute_javascript tool.

The tool uses descriptionFactory to generate a dynamic description that always reflects the connectors available to the current user. Connector visibility is determined by the global access policy (if set) scoped by the agent's userId from ToolContext.

typescript
export function createExecuteJavaScriptTool(
  options?: ExecuteJavaScriptToolOptions,
): ToolFunction&lt;ExecuteJSArgs, ExecuteJSResult&gt;

createFindEntityTool function

📍 src/tools/memory/findEntity.ts:65

typescript
export function createFindEntityTool(
  deps: MemoryToolDeps,
): ToolFunction&lt;FindEntityArgs&gt;

createFindMeetingSlotsTool function

📍 src/tools/microsoft/findMeetingSlots.ts:37

Create a Microsoft Graph find_meeting_slots tool

typescript
export function createFindMeetingSlotsTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;FindMeetingSlotsArgs, MicrosoftFindSlotsResult&gt;

createForgetTool function

📍 src/tools/memory/forget.ts:56

typescript
export function createForgetTool(deps: MemoryToolDeps): ToolFunction&lt;ForgetArgs&gt;

createGetChannelInfoTool function

📍 src/tools/slack/getChannelInfo.ts:24

typescript
export function createGetChannelInfoTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetChannelInfoArgs, SlackGetChannelInfoResult&gt;

createGetMeetingTranscriptTool function

📍 src/tools/microsoft/getMeetingTranscript.ts:57

Create a Microsoft Graph get_meeting_transcript tool

typescript
export function createGetMeetingTranscriptTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;GetMeetingTranscriptArgs, MicrosoftGetTranscriptResult&gt;

createGetMentionsTool function

📍 src/tools/slack/getMentions.ts:30

typescript
export function createGetMentionsTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetMentionsArgs, SlackGetMentionsResult&gt;

createGetMessagesTool function

📍 src/tools/slack/getMessages.ts:31

typescript
export function createGetMessagesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetMessagesArgs, SlackGetMessagesResult&gt;

createGetMessageTool function

📍 src/tools/twilio/getMessage.ts:23

typescript
export function createGetMessageTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetMessageArgs, TwilioGetMessageResult&gt;

createGetPRTool function

📍 src/tools/github/getPR.ts:31

Create a GitHub get_pr tool

typescript
export function createGetPRTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetPRArgs, GitHubGetPRResult&gt;

createGetThreadTool function

📍 src/tools/slack/getThread.ts:28

typescript
export function createGetThreadTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetThreadArgs, SlackGetThreadResult&gt;

createGetUsersTool function

📍 src/tools/slack/getUsers.ts:43

typescript
export function createGetUsersTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GetUsersArgs, SlackGetUsersResult&gt;

createGitHubReadFileTool function

📍 src/tools/github/readFile.ts:46

Create a GitHub read_file tool

typescript
export function createGitHubReadFileTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;GitHubReadFileArgs, GitHubReadFileResult&gt;

createGlobTool function

📍 src/tools/filesystem/glob.ts:100

Create a Glob tool with the given configuration

typescript
export function createGlobTool(config: FilesystemToolConfig = {}): ToolFunction&lt;GlobArgs, GlobResult&gt;

createGraphTool function

📍 src/tools/memory/graph.ts:123

typescript
export function createGraphTool(deps: MemoryToolDeps): ToolFunction&lt;GraphArgs&gt;

createGrepTool function

📍 src/tools/filesystem/grep.ts:181

Create a Grep tool with the given configuration

typescript
export function createGrepTool(config: FilesystemToolConfig = {}): ToolFunction&lt;GrepArgs, GrepResult&gt;

createLinkTool function

📍 src/tools/memory/link.ts:47

typescript
export function createLinkTool(deps: MemoryToolDeps): ToolFunction&lt;LinkArgs&gt;

createListBranchesTool function

📍 src/tools/github/listBranches.ts:43

Create a GitHub list_branches tool

typescript
export function createListBranchesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;ListBranchesArgs, GitHubListBranchesResult&gt;

createListChannelsTool function

📍 src/tools/slack/listChannels.ts:27

typescript
export function createListChannelsTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;ListChannelsArgs, SlackListChannelsResult&gt;

createListDirectoryTool function

📍 src/tools/filesystem/listDirectory.ts:139

Create a List Directory tool with the given configuration

typescript
export function createListDirectoryTool(config: FilesystemToolConfig = {}): ToolFunction&lt;ListDirectoryArgs, ListDirectoryResult&gt;

createListFactsTool function

📍 src/tools/memory/listFacts.ts:59

typescript
export function createListFactsTool(deps: MemoryToolDeps): ToolFunction&lt;ListFactsArgs&gt;

createListMessagesTool function

📍 src/tools/twilio/listMessages.ts:35

typescript
export function createListMessagesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;ListMessagesArgs, TwilioListMessagesResult&gt;

createMeetingTool function

📍 src/tools/microsoft/createMeeting.ts:38

Create a Microsoft Graph create_meeting tool

typescript
export function createMeetingTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;CreateMeetingArgs, MicrosoftCreateMeetingResult&gt;

createMicrosoftListFilesTool function

📍 src/tools/microsoft/listFiles.ts:48

typescript
export function createMicrosoftListFilesTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;ListFilesArgs, MicrosoftListFilesResult&gt;

createMicrosoftReadFileTool function

📍 src/tools/microsoft/readFile.ts:56

typescript
export function createMicrosoftReadFileTool(
  connector: Connector,
  userId?: string,
  config?: MicrosoftReadFileConfig,
  actAs?: string,
): ToolFunction&lt;ReadFileArgs, MicrosoftReadFileResult&gt;

createMicrosoftSearchFilesTool function

📍 src/tools/microsoft/searchFiles.ts:45

NOTE on actAs lock — this tool does NOT participate. It hits Microsoft's tenant-global /search/query (or /sites/{siteId}/drive/root/search when siteId is given), neither of which is user-scoped at the URL level. Data scope is whatever the underlying token can see; the agent-level actAs lock passed to ConnectorTools.for(...) has no effect on this tool.

typescript
export function createMicrosoftSearchFilesTool(
  connector: Connector,
  userId?: string,
): ToolFunction&lt;SearchFilesArgs, MicrosoftSearchFilesResult&gt;

createOutcomeTool function

📍 src/core/createOutcomeTool.ts:23

Create a standard ToolFunction with invocation-owned operational failure reporting. Raw returns and existing tool callback signatures are unchanged. Direct execute() calls run the callback but do not publish a framework outcome. Register the tool with the shared ToolManager to observe a reported failure via executeWithOutcome().

typescript
export function createOutcomeTool&lt;TArgs = any, TResult = any&gt;(
  options: OutcomeToolOptions&lt;TArgs, TResult&gt;,
): ToolFunction&lt;TArgs, TResult&gt;

createPortableToolImplementationFingerprint function

📍 src/portable/AgentPackage.ts:574

Create the stable wire fingerprint used to reject mismatched local executables. Dynamic function descriptions are excluded from the executable contract because each host regenerates them from its own trusted context.

typescript
export function createPortableToolImplementationFingerprint(
  definition: PortableToolDescriptor['definition'],
  implementationId: string,
): string

createPostMessageTool function

📍 src/tools/slack/postMessage.ts:31

typescript
export function createPostMessageTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;PostMessageArgs, SlackPostMessageResult&gt;

createPRCommentsTool function

📍 src/tools/github/prComments.ts:35

Create a GitHub pr_comments tool

typescript
export function createPRCommentsTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;PRCommentsArgs, GitHubPRCommentsResult&gt;

createPRFilesTool function

📍 src/tools/github/prFiles.ts:31

Create a GitHub pr_files tool

typescript
export function createPRFilesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;PRFilesArgs, GitHubPRFilesResult&gt;

createReadFileTool function

📍 src/tools/filesystem/readFile.ts:47

Create a Read File tool with the given configuration

typescript
export function createReadFileTool(config: FilesystemToolConfig = {}): ToolFunction&lt;ReadFileArgs, ReadFileResult&gt;

createRecallTool function

📍 src/tools/memory/recall.ts:43

typescript
export function createRecallTool(deps: MemoryToolDeps): ToolFunction&lt;RecallArgs&gt;

createRememberTool function

📍 src/tools/memory/remember.ts:77

typescript
export function createRememberTool(deps: MemoryToolDeps): ToolFunction&lt;RememberArgs&gt;

createRemoteTool function

📍 src/portable/AgentPackage.ts:392

Build a normal ToolFunction whose execution is delegated through a typed transport.

typescript
export function createRemoteTool(
  packageId: string,
  descriptor: PortableToolDescriptor,
  transport: RemoteToolTransport,
): ToolFunction

createRequestUserInputTool function

📍 src/tools/interaction/requestUserInput.ts:118

Create a request_user_input tool bound to the given delivery.

The returned tool, when called by the agent, returns a SuspendSignal — the agent loop catches it, performs a final wrap-up LLM call without tools, saves the session, persists the correlation, and returns AgentResponse { status: 'suspended' } to the caller.

typescript
export function createRequestUserInputTool(
  delivery: IUserInteractionDelivery,
  options: CreateRequestUserInputToolOptions = {},
): ToolFunction&lt;RequestUserInputToolArgs, SuspendSignal&gt;

createResolvedLocalTool function

📍 src/portable/AgentPackage.ts:625

Resolve a trusted local executable with a fingerprint suitable for package hydration. Custom tools require a stable implementation ID shared by the exporting and receiving runtimes. Generated built-ins use registry metadata.

typescript
export function createResolvedLocalTool(
  tool: ToolFunction,
  implementationId?: string,
): ResolvedLocalTool

createRestoreTool function

📍 src/tools/memory/restore.ts:27

typescript
export function createRestoreTool(deps: MemoryToolDeps): ToolFunction&lt;RestoreArgs&gt;

createRoutineTool function

📍 src/core/createRoutineTool.ts:122

Create a non-blocking ToolFunction from a RoutineDefinition.

The tool:

  • Has blocking: false — executes asynchronously
  • Spawns a fresh agent via createAgent() per invocation
  • Runs executeRoutine() with the definition and input args
  • Destroys the agent after completion (success or failure)
  • Returns task results as the tool output
typescript
export function createRoutineTool(options: CreateRoutineToolOptions): ToolFunction

createSearchCodeTool function

📍 src/tools/github/searchCode.ts:104

Create a GitHub search_code tool

typescript
export function createSearchCodeTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SearchCodeArgs, GitHubSearchCodeResult&gt;

createSearchFilesTool function

📍 src/tools/github/searchFiles.ts:58

Create a GitHub search_files tool

typescript
export function createSearchFilesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SearchFilesArgs, GitHubSearchFilesResult&gt;

createSearchMessagesTool function

📍 src/tools/slack/searchMessages.ts:29

typescript
export function createSearchMessagesTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SearchMessagesArgs, SlackSearchMessagesResult&gt;

createSearchTool function

📍 src/tools/memory/search.ts:48

typescript
export function createSearchTool(deps: MemoryToolDeps): ToolFunction&lt;SearchArgs&gt;

createSendEmailTool function

📍 src/tools/microsoft/sendEmail.ts:38

Create a Microsoft Graph send_email tool

typescript
export function createSendEmailTool(
  connector: Connector,
  userId?: string,
  actAs?: string,
): ToolFunction&lt;SendEmailArgs, MicrosoftSendEmailResult&gt;

createSendSMSTool function

📍 src/tools/twilio/sendSMS.ts:30

typescript
export function createSendSMSTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SendSMSArgs, TwilioSendResult&gt;

createSendWhatsAppTool function

📍 src/tools/twilio/sendWhatsApp.ts:37

typescript
export function createSendWhatsAppTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SendWhatsAppArgs, TwilioSendResult&gt;

createSetAgentRuleTool function

📍 src/tools/memory/setAgentRule.ts:102

typescript
export function createSetAgentRuleTool(deps: MemoryToolDeps): ToolFunction&lt;SetAgentRuleArgs&gt;

createSetChannelTopicTool function

📍 src/tools/slack/setChannelTopic.ts:25

typescript
export function createSetChannelTopicTool(
  connector: Connector,
  userId?: string
): ToolFunction&lt;SetChannelTopicArgs, SlackSetChannelTopicResult&gt;

createSpeechToTextTool function

📍 src/tools/multimedia/speechToText.ts:31

typescript
export function createSpeechToTextTool(
  connector: Connector,
  storage?: IMediaStorage,
): ToolFunction&lt;SpeechToTextArgs, SpeechToTextResult&gt;

createTextToSpeechTool function

📍 src/tools/multimedia/textToSpeech.ts:33

typescript
export function createTextToSpeechTool(
  connector: Connector,
  storage?: IMediaStorage,
  userId?: string
): ToolFunction&lt;TextToSpeechArgs, TextToSpeechResult&gt;

createUpsertEntityTool function

📍 src/tools/memory/upsertEntity.ts:113

typescript
export function createUpsertEntityTool(
  deps: MemoryToolDeps,
): ToolFunction&lt;UpsertEntityArgs&gt;

createWriteFileTool function

📍 src/tools/filesystem/writeFile.ts:38

Create a Write File tool with the given configuration

typescript
export function createWriteFileTool(config: FilesystemToolConfig = {}): ToolFunction&lt;WriteFileArgs, WriteFileResult&gt;

defaultDescribeCall function

📍 src/domain/entities/Tool.ts:315

Default implementation for describeCall. Shows the first meaningful argument value.

typescript
export function defaultDescribeCall(
  args: Record&lt;string, unknown&gt;,
  maxLength = 60
): string

Example:

typescript
defaultDescribeCall({ file_path: '/path/to/file.ts' })
// Returns: '/path/to/file.ts'
typescript
defaultDescribeCall({ query: 'search term', limit: 10 })
// Returns: 'search term'

generateWebAPITool function

📍 src/connectors/toolGenerator.ts:53

Generate a universal API request tool for all registered OAuth providers

This tool allows the AI agent to make authenticated requests to any registered API. The tool description is dynamically generated based on registered providers.

typescript
export function generateWebAPITool(): ToolFunction&lt;APIRequestArgs, APIRequestResult&gt;

getAllBuiltInTools function

📍 src/tools/registry.generated.ts:473

Get all built-in tools as ToolFunction array

typescript
export function getAllBuiltInTools(): ToolFunction[]

getConnectorTools function

📍 src/connectors/vendors/helpers.ts:513

Get all tools for a connector (delegates to ConnectorTools)

typescript
export function getConnectorTools(connectorName: string): ToolFunction[]

getToolByName function

📍 src/tools/registry.generated.ts:488

Get tool by name

typescript
export function getToolByName(name: string): ToolRegistryEntry | undefined

getToolCallDescription function

📍 src/domain/entities/Tool.ts:367

Get a human-readable description of a tool call. Uses the tool's describeCall method if available, otherwise falls back to default.

typescript
export function getToolCallDescription&lt;TArgs&gt;(
  tool: ToolFunction&lt;TArgs&gt;,
  args: TArgs
): string

getToolCategories function

📍 src/tools/registry.generated.ts:498

Get all unique category names

typescript
export function getToolCategories(): ToolCategory[]

getToolRegistry function

📍 src/tools/registry.generated.ts:478

Get full tool registry with metadata

typescript
export function getToolRegistry(): ToolRegistryEntry[]

getToolsByCategory function

📍 src/tools/registry.generated.ts:483

Get tools by category

typescript
export function getToolsByCategory(category: ToolCategory): ToolRegistryEntry[]

getToolsRequiringConnector function

📍 src/tools/registry.generated.ts:493

Get tools that require connector configuration

typescript
export function getToolsRequiringConnector(): ToolRegistryEntry[]

hydrateCustomTool function

📍 src/tools/custom-tools/hydrate.ts:32

Convert a stored CustomToolDefinition into an executable ToolFunction.

The resulting ToolFunction:

  • Executes the definition's code through executeInVM
  • Has input args passed as input in the VM sandbox
  • Gets connector registry from ToolContext for authenticatedFetch
  • Has session-scoped permission with medium risk level
typescript
export function hydrateCustomTool(
  definition: CustomToolDefinition,
  options?: HydrateOptions,
): ToolFunction

isToolCallArgumentsDelta function

📍 src/domain/entities/StreamEvent.ts:366

typescript
export function isToolCallArgumentsDelta(
  event: StreamEvent
): event is ToolCallArgumentsDeltaEvent

isToolCallArgumentsDone function

📍 src/domain/entities/StreamEvent.ts:372

typescript
export function isToolCallArgumentsDone(
  event: StreamEvent
): event is ToolCallArgumentsDoneEvent

isToolCallStart function

📍 src/domain/entities/StreamEvent.ts:362

typescript
export function isToolCallStart(event: StreamEvent): event is ToolCallStartEvent

registerRoutineToolCategory function

📍 src/core/createRoutineTool.ts:198

Register routine definitions as a ToolCatalog category.

Each routine becomes a CatalogToolEntry with a createTool factory for lazy instantiation when loaded via tool_catalog_load.

typescript
export function registerRoutineToolCategory(options: RoutineToolCatalogOptions): void

Example:

typescript
registerRoutineToolCategory({
  definitions: [routineA, routineB],
  createAgent: (def) => Agent.create({
    connector: def.metadata?.connector as string ?? 'openai',
    model: def.metadata?.model as string ?? 'gpt-4',
  }),
});
// Agents can now: tool_catalog_search → tool_catalog_load('routines:executable')

resolveConnectorContext function

📍 src/tools/connector/ConnectorTools.ts:229

Resolve effective userId and accountId from ToolContext.

Use this in every connector tool's execute() function to consistently extract account identity. Prevents the common mistake of reading userId but forgetting accountId.

typescript
export function resolveConnectorContext(
  context: ToolContext | undefined,
  fallbackUserId?: string,
): { userId: string | undefined; accountId: string | undefined }

sanitizeToolName function

📍 src/core/createRoutineTool.ts:80

Sanitize a routine name into a valid tool name. Converts to lowercase, replaces non-alphanumeric runs with underscores, trims trailing underscores.

typescript
function sanitizeToolName(name: string): string

sanitizeToolName function

📍 src/utils/sanitize.ts:11

Sanitize a string to be a valid tool name. Matches the common denominator pattern across all LLM providers: ^[a-zA-Z0-9_-]+$

  • Replaces invalid characters (spaces, special chars, unicode) with underscores
  • Collapses consecutive underscores into one
  • Strips leading/trailing underscores and hyphens
  • Prepends 'n_' if the result starts with a digit
  • Returns 'unnamed' if the result would be empty
typescript
export function sanitizeToolName(name: string): string

Documentation snapshot · 2026-11-02Suggest a correction ↗

Search documentation

Type to search the v2 documentation.