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
constructor(
private readonly agent: Agent,
private readonly packageValue: SerializedAgentPackage,
)
Parameters:
agent:AgentpackageValue:SerializedAgentPackage
Methods
start()
async start(): Promise<void>
Returns: Promise<void>
execute()
async execute(input: unknown): Promise<RemoteToolExecutionResponse>
Parameters:
input:unknown
Returns: Promise<RemoteToolExecutionResponse>
close()
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:
// 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.
static enhanced(connectorOrName: Connector | string, options: EnhancedConnectorOptions): ToolFunction[]
Parameters:
connectorOrName:string | Connectoroptions:EnhancedConnectorOptions
Returns: ToolFunction<any, any>[]
static clearCache()
Clear all caches (useful for testing or when connectors change)
static clearCache(): void
Returns: void
static invalidateCache()
Invalidate cache for a specific connector
static invalidateCache(connectorName: string): void
Parameters:
connectorName:string
Returns: void
static registerService()
Register a tool factory for a service type
static registerService(serviceType: string, factory: ServiceToolFactory): void
Parameters:
serviceType:stringfactory:ServiceToolFactory
Returns: void
static unregisterService()
Unregister a service tool factory
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
static for(connectorOrName: Connector | string, userId?: string, options?: ConnectorToolsOptions): ToolFunction[]
Parameters:
connectorOrName:string | ConnectoruserId: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)
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
static findConnector(serviceType: string, options?: ConnectorToolsOptions): Connector | undefined
Parameters:
serviceType:stringoptions: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
static findConnectors(serviceType: string, options?: ConnectorToolsOptions): Connector[]
Parameters:
serviceType:stringoptions:ConnectorToolsOptions | undefined(optional)
Returns: Connector[]
static listSupportedServices()
List services that have registered tool factories
static listSupportedServices(): string[]
Returns: string[]
static hasServiceTools()
Check if a service has dedicated tool factory
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
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.
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
constructor(
toolName: string,
public readonly rawArguments: string,
public readonly parseError?: Error
)
Parameters:
toolName:stringrawArguments:stringparseError:Error | undefined(optional)
MCPToolError class
📍 src/domain/errors/MCPError.ts:62
Tool execution errors (tool not found, tool execution failed)
Constructor
constructor
constructor(
message: string,
public readonly toolName: string,
serverName?: string,
cause?: Error
)
Parameters:
message:stringtoolName:stringserverName:string | undefined(optional)cause:Error | undefined(optional)
RemoteToolExecutionError class
📍 src/portable/AgentPackage.ts:65
Constructor
constructor
constructor(code: string, message: string, retryable = false)
Parameters:
code:stringmessage:stringretryable: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
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.
registerHandler(handler: IStoreHandler): void
Parameters:
handler:IStoreHandler
Returns: void
unregisterHandler()
Unregister a store handler by storeId.
unregisterHandler(storeId: string): boolean
Parameters:
storeId:string
Returns: boolean
getHandler()
Get a handler by storeId.
getHandler(storeId: string): IStoreHandler | undefined
Parameters:
storeId:string
Returns: IStoreHandler | undefined
getSchemas()
Get all registered store schemas (for building tool descriptions).
getSchemas(): StoreEntrySchema[]
Returns: StoreEntrySchema[]
getStoreIds()
Get all registered store IDs.
getStoreIds(): string[]
Returns: string[]
getTools()
Create the 5 generic store tools. Called once when the first IStoreHandler is registered.
getTools(): ToolFunction[]
Returns: ToolFunction<any, any>[]
destroy()
Cleanup.
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.
buildOverview(): string
Returns: string
ToolCatalogPluginNextGen class
📍 src/core/context-nextgen/plugins/ToolCatalogPluginNextGen.ts:137
Constructor
constructor
constructor(config?: ToolCatalogPluginConfig)
Parameters:
config:ToolCatalogPluginConfig | undefined(optional)
Methods
getInstructions()
getInstructions(): string
Returns: string
getInstructionsTokenSize()
getInstructionsTokenSize(): number
Returns: number
getContent()
async getContent(): Promise<string | null>
Returns: Promise<string | null>
getContents()
getContents(): unknown
Returns: unknown
getTools()
getTools(): ToolFunction[]
Returns: ToolFunction<any, any>[]
isCompactable()
isCompactable(): boolean
Returns: boolean
compact()
async compact(targetTokensToFree: number): Promise<number>
Parameters:
targetTokensToFree:number
Returns: Promise<number>
getState()
getState(): unknown
Returns: unknown
restoreState()
restoreState(state: unknown): void
Parameters:
state:unknown
Returns: void
destroy()
destroy(): void
Returns: void
setToolManager()
Set the ToolManager reference. Called by AgentContextNextGen after plugin registration.
setToolManager(tm: ToolManager): void
Parameters:
tm:ToolManager
Returns: void
executeLoad()
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'
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)
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.
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.
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.
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).
static registerTools(category: string, tools: CatalogToolEntry[]): void
Parameters:
category:stringtools:CatalogToolEntry[]
Returns: void
static registerTool()
Register a single tool in a category.
static registerTool(category: string, tool: CatalogToolEntry): void
Parameters:
category:stringtool:CatalogToolEntry
Returns: void
static unregisterCategory()
Unregister a category and all its tools.
static unregisterCategory(category: string): boolean
Parameters:
category:string
Returns: boolean
static unregisterTool()
Unregister a single tool from a category.
static unregisterTool(category: string, toolName: string): boolean
Parameters:
category:stringtoolName:string
Returns: boolean
static getCategories()
Get all registered categories.
static getCategories(): ToolCategoryDefinition[]
Returns: ToolCategoryDefinition[]
static getCategory()
Get a single category by name.
static getCategory(name: string): ToolCategoryDefinition | undefined
Parameters:
name:string
Returns: ToolCategoryDefinition | undefined
static hasCategory()
Check if a category exists.
static hasCategory(name: string): boolean
Parameters:
name:string
Returns: boolean
static getToolsInCategory()
Get all tools in a category.
static getToolsInCategory(category: string): CatalogToolEntry[]
Parameters:
category:string
Returns: CatalogToolEntry[]
static getAllCatalogTools()
Get all catalog tools across all categories.
static getAllCatalogTools(): CatalogToolEntry[]
Returns: CatalogToolEntry[]
static findTool()
Find a tool by name across all categories.
static findTool(name: string): { category: string; entry: CatalogToolEntry } | undefined
Parameters:
name:string
Returns: { category: string; entry: CatalogToolEntry; } | undefined
static filterCategories()
Filter categories by scope.
static filterCategories(scope?: ToolCategoryScope): ToolCategoryDefinition[]
Parameters:
scope:ToolCategoryScope | undefined(optional)
Returns: ToolCategoryDefinition[]
static isCategoryAllowed()
Check if a category is allowed by a scope.
static isCategoryAllowed(name: string, scope?: ToolCategoryScope): boolean
Parameters:
name:stringscope: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.
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 }).
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).
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.
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.
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.
static initializeFromRegistry(registry: ToolRegistryEntry[]): void
Parameters:
registry:ToolRegistryEntry[]
Returns: void
static reset()
Reset the registry. Primarily for testing.
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
constructor(config: ToolEvidenceConfig)
Parameters:
config:ToolEvidenceConfig
Methods
record()
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:unknowncontext:ToolContextoutcome:ToolExecutionOutcomeresult:{ 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
constructor(
toolName: string,
message: string,
public readonly originalError?: Error
)
Parameters:
toolName:stringmessage:stringoriginalError: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:
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
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.
use(plugin: IToolExecutionPlugin): this
Parameters:
plugin:IToolExecutionPlugin
Returns: this
remove()
Remove a plugin by name.
remove(pluginName: string): boolean
Parameters:
pluginName:string
Returns: boolean
has()
Check if a plugin is registered.
has(pluginName: string): boolean
Parameters:
pluginName:string
Returns: boolean
get()
Get a registered plugin by name.
get(pluginName: string): IToolExecutionPlugin | undefined
Parameters:
pluginName:string
Returns: IToolExecutionPlugin | undefined
list()
List all registered plugins, sorted by priority.
list(): IToolExecutionPlugin[]
Returns: IToolExecutionPlugin[]
execute()
Execute a tool through the plugin pipeline.
Execution phases:
- beforeExecute hooks (in priority order, lowest first)
- Tool execution (if not aborted)
- afterExecute hooks (in reverse priority order for proper unwinding)
- onError hooks if any phase fails
async execute(tool: ToolFunction, args: unknown, options: PipelineExecutionOptions = {}): Promise<unknown>
Parameters:
tool:ToolFunction<any, any>args:unknownoptions:PipelineExecutionOptions(optional) (default:{})
Returns: Promise<unknown>
ToolManager class
Constructor
constructor
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).
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.
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.
mergeToolContext(partial: Partial<ToolContext>): void
Parameters:
partial:Partial<ToolContext>
Returns: void
getToolContext()
Get current tool context
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.
setPermissionManager(manager: PermissionPolicyManager): void
Parameters:
manager:PermissionPolicyManager
Returns: void
getPermissionManager()
Get the permission policy manager (if enforcement is active).
getPermissionManager(): PermissionPolicyManager | undefined
Returns: PermissionPolicyManager | undefined
hasPermissionEnforcement()
Check if permission enforcement is active on the execution pipeline.
hasPermissionEnforcement(): boolean
Returns: boolean
register()
Register a tool with optional configuration
register(tool: ToolFunction, options: ToolOptions = {}): void
Parameters:
tool:ToolFunction<any, any>options:ToolOptions(optional) (default:{})
Returns: void
registerMany()
Register multiple tools at once
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.
registerConnectorTools(connectorName: string, tools: ToolFunction[], options: Omit<ToolOptions, 'source'> & { accountId?: string } = {}): void
Parameters:
connectorName:stringtools:ToolFunction<any, any>[]options:Omit<ToolOptions, "source"> & { accountId?: string | undefined; }(optional) (default:{})
Returns: void
unregister()
Unregister a tool by name
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).
clear(): void
Returns: void
enable()
Enable a tool by name
enable(name: string): boolean
Parameters:
name:string
Returns: boolean
disable()
Disable a tool by name (keeps it registered but inactive)
disable(name: string): boolean
Parameters:
name:string
Returns: boolean
toggle()
Toggle a tool's enabled state
toggle(name: string): boolean
Parameters:
name:string
Returns: boolean
isEnabled()
Check if a tool is enabled
isEnabled(name: string): boolean
Parameters:
name:string
Returns: boolean
setEnabled()
Set enabled state for multiple tools
setEnabled(names: string[], enabled: boolean): void
Parameters:
names:string[]enabled:boolean
Returns: void
setNamespace()
Set the namespace for a tool
setNamespace(toolName: string, namespace: string): boolean
Parameters:
toolName:stringnamespace:string
Returns: boolean
enableNamespace()
Enable all tools in a namespace
enableNamespace(namespace: string): void
Parameters:
namespace:string
Returns: void
disableNamespace()
Disable all tools in a namespace
disableNamespace(namespace: string): void
Parameters:
namespace:string
Returns: void
getNamespaces()
Get all namespace names
getNamespaces(): string[]
Returns: string[]
createNamespace()
Create a namespace with tools
createNamespace(namespace: string, tools: ToolFunction[], options: Omit<ToolOptions, 'namespace'> = {}): void
Parameters:
namespace:stringtools:ToolFunction<any, any>[]options:Omit<ToolOptions, "namespace">(optional) (default:{})
Returns: void
setPriority()
Set priority for a tool
setPriority(name: string, priority: number): boolean
Parameters:
name:stringpriority:number
Returns: boolean
getPriority()
Get priority for a tool
getPriority(name: string): number | undefined
Parameters:
name:string
Returns: number | undefined
getPermission()
Get permission config for a tool
getPermission(name: string): ToolPermissionConfig | undefined
Parameters:
name:string
Returns: ToolPermissionConfig | undefined
setPermission()
Set permission config for a tool
setPermission(name: string, permission: ToolPermissionConfig): boolean
Parameters:
name:stringpermission:ToolPermissionConfig
Returns: boolean
get()
Get a tool by name
get(name: string): ToolFunction | undefined
Parameters:
name:string
Returns: ToolFunction<any, any> | undefined
has()
Check if a tool exists
has(name: string): boolean
Parameters:
name:string
Returns: boolean
getEnabled()
Get all enabled tools (sorted by priority)
getEnabled(): ToolFunction[]
Returns: ToolFunction<any, any>[]
getEnabledRegistrations()
Get all enabled registrations (sorted by priority). Includes full registration metadata (source, namespace, etc.) for use in connector-aware filtering.
getEnabledRegistrations(): ToolRegistration[]
Returns: ToolRegistration[]
getAll()
Get all tools (enabled and disabled)
getAll(): ToolFunction[]
Returns: ToolFunction<any, any>[]
getByNamespace()
Get tools by namespace
getByNamespace(namespace: string): ToolFunction[]
Parameters:
namespace:string
Returns: ToolFunction<any, any>[]
getByCategory()
Get all registered tool names in a category. Used by ToolCatalogPlugin for bulk enable/disable.
getByCategory(category: string): string[]
Parameters:
category:string
Returns: string[]
getRegistration()
Get tool registration info
getRegistration(name: string): ToolRegistration | undefined
Parameters:
name:string
Returns: ToolRegistration | undefined
list()
List all tool names
list(): string[]
Returns: string[]
listEnabled()
List enabled tool names
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'sdefinition.function.descriptioncategory: optional groupingconnectorName: present for connector-bound tools (read fromtool.connectorName, falling back to parsing the registrationsourcelike'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.
listCompact(): CompactToolDescriptor[]
Returns: CompactToolDescriptor[]
selectForContext()
Select tools based on context (uses conditions and smart filtering)
selectForContext(context: ToolSelectionContext): ToolFunction[]
Parameters:
context:ToolSelectionContext
Returns: ToolFunction<any, any>[]
selectByCapability()
Select tools by matching capability description
selectByCapability(description: string): ToolFunction[]
Parameters:
description:string
Returns: ToolFunction<any, any>[]
selectWithinBudget()
Filter tools to fit within a token budget
selectWithinBudget(budget: number): ToolFunction[]
Parameters:
budget:number
Returns: ToolFunction<any, any>[]
recordExecution()
Record tool execution (called by agent/loop)
recordExecution(
name: string,
executionMs: number,
success: boolean
): void
Parameters:
name:stringexecutionMs:numbersuccess:boolean
Returns: void
getStats()
Get comprehensive statistics
getStats(): ToolManagerStats
Returns: ToolManagerStats
setEvidenceMiddleware()
Opt-in post-settlement evidence handling. Does not replace the execution pipeline.
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:
- Validate tool exists and is enabled
- Check circuit breaker state
- Run through plugin pipeline (beforeExecute -> execute -> afterExecute)
- Update metrics and circuit breaker state
Simple execution - no caching, no parent context. Context must be set via setToolContext() before calling.
async execute(toolName: string, args: any, options?: ToolExecutionOptions): Promise<any>
Parameters:
toolName:stringargs:anyoptions:ToolExecutionOptions | undefined(optional)
Returns: Promise<any>
executeWithOutcome()
Execute with semantic metadata while retaining the legacy raw result contract.
async executeWithOutcome(toolName: string, args: any, options: ToolExecutionOptions = {}): Promise<ToolExecutionReport<any>>
Parameters:
toolName:stringargs:anyoptions:ToolExecutionOptions(optional) (default:{})
Returns: Promise<ToolExecutionReport<any>>
hasToolFunction()
Check if tool is available (IToolExecutor interface)
hasToolFunction(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
getToolDefinition()
Get tool definition (IToolExecutor interface)
getToolDefinition(toolName: string): Tool | undefined
Parameters:
toolName:string
Returns: Tool | undefined
registerTool()
Register a tool (IToolExecutor interface - delegates to register())
registerTool(tool: ToolFunction): void
Parameters:
tool:ToolFunction<any, any>
Returns: void
unregisterTool()
Unregister a tool (IToolExecutor interface - delegates to unregister())
unregisterTool(toolName: string): void
Parameters:
toolName:string
Returns: void
listTools()
List all registered tool names (IToolExecutor interface - delegates to list())
listTools(): string[]
Returns: string[]
getCircuitBreakerStates()
Get circuit breaker states for all tools
getCircuitBreakerStates(): Map<string, CircuitState>
Returns: Map<string, CircuitState>
getToolCircuitBreakerMetrics()
Get circuit breaker metrics for a specific tool
getToolCircuitBreakerMetrics(toolName: string)
Parameters:
toolName:string
Returns: CircuitBreakerMetrics | undefined
resetToolCircuitBreaker()
Manually reset a tool's circuit breaker
resetToolCircuitBreaker(toolName: string): void
Parameters:
toolName:string
Returns: void
setCircuitBreakerConfig()
Configure circuit breaker for a tool
setCircuitBreakerConfig(toolName: string, config: CircuitBreakerConfig): boolean
Parameters:
toolName:stringconfig:CircuitBreakerConfig
Returns: boolean
getState()
Get serializable state (for session persistence)
getState(): SerializedToolState
Returns: SerializedToolState
loadState()
Load state (restores enabled/disabled, namespaces, priorities, permissions) Note: Tools must be re-registered separately (they contain functions)
loadState(state: SerializedToolState): void
Parameters:
state:SerializedToolState
Returns: void
ToolNotFoundError class
📍 src/domain/errors/AIErrors.ts:145
Constructor
constructor
constructor(toolName: string)
Parameters:
toolName:string
ToolPermissionManager class
📍 src/core/permissions/ToolPermissionManager.ts:56
Constructor
constructor
constructor(config?: AgentPermissionsConfig)
Parameters:
config:AgentPermissionsConfig | undefined(optional)
Methods
checkPermission()
Check if a tool needs approval before execution
checkPermission(toolName: string, _args?: Record<string, unknown>): PermissionCheckResult
Parameters:
toolName:string_args:Record<string, unknown> | undefined(optional)
Returns: PermissionCheckResult
needsApproval()
Check if a tool call needs approval (uses ToolCall object)
needsApproval(toolCall: ToolCall): boolean
Parameters:
toolCall:ToolCall
Returns: boolean
isBlocked()
Check if a tool is blocked
isBlocked(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
isApproved()
Check if a tool is approved (either allowlisted or session-approved)
isApproved(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
approve()
Approve a tool (record approval)
approve(toolName: string, decision?: Partial<ApprovalDecision>): void
Parameters:
toolName:stringdecision:Partial<ApprovalDecision> | undefined(optional)
Returns: void
approveForSession()
Approve a tool for the entire session
approveForSession(toolName: string, approvedBy?: string): void
Parameters:
toolName:stringapprovedBy:string | undefined(optional)
Returns: void
revoke()
Revoke a tool's approval
revoke(toolName: string): void
Parameters:
toolName:string
Returns: void
deny()
Deny a tool execution (for audit trail)
deny(toolName: string, reason: string): void
Parameters:
toolName:stringreason:string
Returns: void
isApprovedForSession()
Check if a tool has been approved for the current session
isApprovedForSession(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
allowlistAdd()
Add a tool to the allowlist (always allowed)
allowlistAdd(toolName: string): void
Parameters:
toolName:string
Returns: void
allowlistRemove()
Remove a tool from the allowlist
allowlistRemove(toolName: string): void
Parameters:
toolName:string
Returns: void
isAllowlisted()
Check if a tool is in the allowlist
isAllowlisted(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
getAllowlist()
Get all allowlisted tools
getAllowlist(): string[]
Returns: string[]
blocklistAdd()
Add a tool to the blocklist (always blocked)
blocklistAdd(toolName: string): void
Parameters:
toolName:string
Returns: void
blocklistRemove()
Remove a tool from the blocklist
blocklistRemove(toolName: string): void
Parameters:
toolName:string
Returns: void
isBlocklisted()
Check if a tool is in the blocklist
isBlocklisted(toolName: string): boolean
Parameters:
toolName:string
Returns: boolean
getBlocklist()
Get all blocklisted tools
getBlocklist(): string[]
Returns: string[]
setToolConfig()
Set permission config for a specific tool
setToolConfig(toolName: string, config: ToolPermissionConfig): void
Parameters:
toolName:stringconfig:ToolPermissionConfig
Returns: void
getToolConfig()
Get permission config for a specific tool
getToolConfig(toolName: string): ToolPermissionConfig | undefined
Parameters:
toolName:string
Returns: ToolPermissionConfig | undefined
getEffectiveConfig()
Get effective config (tool-specific or defaults)
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:
- Set onApprovalRequired callback in AgentPermissionsConfig
- Register an 'approve:tool' hook in the Agent
- 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.
async requestApproval(context: PermissionCheckContext): Promise<ApprovalDecision>
Parameters:
context:PermissionCheckContext
Returns: Promise<ApprovalDecision>
getApprovedTools()
Get all tools that have session approvals
getApprovedTools(): string[]
Returns: string[]
getApprovalEntry()
Get the approval entry for a tool
getApprovalEntry(toolName: string): ApprovalCacheEntry | undefined
Parameters:
toolName:string
Returns: ApprovalCacheEntry | undefined
clearSession()
Clear all session approvals
clearSession(): void
Returns: void
getState()
Serialize approval state for persistence
getState(): SerializedApprovalState
Returns: SerializedApprovalState
loadState()
Load approval state from persistence
loadState(state: SerializedApprovalState): void
Parameters:
state:SerializedApprovalState
Returns: void
getDefaults()
Get defaults
getDefaults(): { scope: PermissionScope; riskLevel: RiskLevel }
Returns: { scope: PermissionScope; riskLevel: RiskLevel; }
setDefaults()
Set defaults
setDefaults(defaults: { scope?: PermissionScope; riskLevel?: RiskLevel }): void
Parameters:
defaults:{ scope?: PermissionScope | undefined; riskLevel?: RiskLevel | undefined; }
Returns: void
getStats()
Get summary statistics
getStats(): {
approvedCount: number;
allowlistedCount: number;
blocklistedCount: number;
configuredCount: number;
}
Returns: { approvedCount: number; allowlistedCount: number; blocklistedCount: number; configuredCount: number; }
reset()
Reset to initial state
reset(): void
Returns: void
destroy()
Destroy the permission manager and release all resources
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)
static getBuiltInTools(): ToolRegistryEntry[]
Returns: ToolRegistryEntry[]
static getConnectorTools()
Get tools for a specific connector
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)
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.
static getAllTools(): (ToolRegistryEntry | ConnectorToolEntry)[]
Returns: (ToolRegistryEntry | ConnectorToolEntry)[]
static getToolsByService()
Get tools filtered by service type
static getToolsByService(serviceType: string): ConnectorToolEntry[]
Parameters:
serviceType:string
Returns: ConnectorToolEntry[]
static getToolsByConnector()
Get tools filtered by connector name
static getToolsByConnector(connectorName: string): ConnectorToolEntry[]
Parameters:
connectorName:string
Returns: ConnectorToolEntry[]
static isConnectorTool()
Check if a tool entry is a connector tool
static isConnectorTool(entry: ToolRegistryEntry | ConnectorToolEntry): entry is ConnectorToolEntry
Parameters:
entry:ToolRegistryEntry | ConnectorToolEntry
Returns: boolean
ToolTimeoutError class
📍 src/domain/errors/AIErrors.ts:130
Constructor
constructor
constructor(
toolName: string,
public readonly timeoutMs: number
)
Parameters:
toolName:stringtimeoutMs: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()?
onObservation?(report: Readonly<RemoteOutcomeReport>): void;
Parameters:
report:Readonly<RemoteOutcomeReport>
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<string, unknown>) => 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
targetUserschema parameter is OMITTED and this value is always used. - When unset: existing behavior (LLM supplies
targetUserfor 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<string, unknown>; |
JSON Schema for input parameters |
outputSchema? |
outputSchema?: Record<string, unknown>; |
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<string, unknown>; |
- |
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<'direct' | 'programmatic'>; | 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<string, unknown>; |
- |
queryParams? |
`queryParams?: Record<string, string | number |
headers? |
headers?: Record<string, string>; |
- |
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
save(userId: string | undefined, definition: CustomToolDefinition): Promise<void>;
Parameters:
userId:string | undefineddefinition:CustomToolDefinition
Returns: Promise<void>
load()
Load a custom tool definition by name
load(userId: string | undefined, name: string): Promise<CustomToolDefinition | null>;
Parameters:
userId:string | undefinedname:string
Returns: Promise<CustomToolDefinition | null>
delete()
Delete a custom tool definition by name
delete(userId: string | undefined, name: string): Promise<void>;
Parameters:
userId:string | undefinedname:string
Returns: Promise<void>
exists()
Check if a custom tool exists
exists(userId: string | undefined, name: string): Promise<boolean>;
Parameters:
userId:string | undefinedname:string
Returns: Promise<boolean>
list()
List custom tools (summaries only)
list(userId: string | undefined, options?: CustomToolListOptions): Promise<CustomToolSummary[]>;
Parameters:
userId:string | undefinedoptions:CustomToolListOptions | undefined(optional)
Returns: Promise<CustomToolSummary[]>
updateMetadata()?
Update metadata without loading full definition
updateMetadata?(userId: string | undefined, name: string, metadata: Record<string, unknown>): Promise<void>;
Parameters:
userId:string | undefinedname:stringmetadata:Record<string, unknown>
Returns: Promise<void>
getPath()
Get the storage path/location for a specific user (for display/debugging)
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.
use(plugin: IToolExecutionPlugin): this;
Parameters:
plugin:IToolExecutionPlugin
Returns: this
remove()
Remove a plugin by name.
remove(pluginName: string): boolean;
Parameters:
pluginName:string
Returns: boolean
has()
Check if a plugin is registered.
has(pluginName: string): boolean;
Parameters:
pluginName:string
Returns: boolean
get()
Get a registered plugin by name.
get(pluginName: string): IToolExecutionPlugin | undefined;
Parameters:
pluginName:string
Returns: IToolExecutionPlugin | undefined
list()
List all registered plugins (sorted by priority).
list(): IToolExecutionPlugin[];
Returns: IToolExecutionPlugin[]
execute()
Execute a tool through the plugin pipeline.
execute(tool: ToolFunction, args: unknown, options?: PipelineExecutionOptions): Promise<unknown>;
Parameters:
tool:ToolFunction<any, any>args:unknownoptions:PipelineExecutionOptions | undefined(optional)
Returns: Promise<unknown>
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:
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
beforeExecute?(ctx: PluginExecutionContext): Promise<BeforeExecuteResult>;
Parameters:
ctx:PluginExecutionContext
Returns: Promise<BeforeExecuteResult>
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.
afterExecute?(ctx: PluginExecutionContext, result: unknown): Promise<unknown>;
Parameters:
ctx:PluginExecutionContextresult:unknown
Returns: Promise<unknown>
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
onError?(ctx: PluginExecutionContext, error: Error): Promise<unknown>;
Parameters:
ctx:PluginExecutionContexterror:Error
Returns: Promise<unknown>
onRegister()?
Called when plugin is registered with a pipeline. Use for setup that requires pipeline reference.
onRegister?(pipeline: IToolExecutionPipeline): void;
Parameters:
pipeline:IToolExecutionPipeline
Returns: void
onUnregister()?
Called when plugin is unregistered from a pipeline. Use for cleanup.
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
execute(toolName: string, args: any): Promise<any>;
Parameters:
toolName:stringargs:any
Returns: Promise<any>
hasToolFunction()
Check if tool is available
hasToolFunction(toolName: string): boolean;
Parameters:
toolName:string
Returns: boolean
getToolDefinition()
Get tool definition
getToolDefinition(toolName: string): Tool | undefined;
Parameters:
toolName:string
Returns: Tool | undefined
registerTool()
Register a new tool
registerTool(tool: ToolFunction): void;
Parameters:
tool:ToolFunction<any, any>
Returns: void
unregisterTool()
Unregister a tool
unregisterTool(toolName: string): void;
Parameters:
toolName:string
Returns: void
listTools()
List all registered tools
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<string, any>; |
- |
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<string, unknown>;
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<string, unknown>; |
- |
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<string, Agent>; |
Live worker agent instances (name → Agent) |
agentTypes |
agentTypes: Map<string, AgentTypeConfig>; |
Registered agent type configurations |
lastTurnTimestamps |
lastTurnTimestamps: Map<string, number>; |
Timestamp of each agent's last completed turn (for workspace deltas) |
createWorkerAgent |
createWorkerAgent: (name: string, type: string) => 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.
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<string, unknown>; |
- |
startTime |
startTime: number; |
- |
status |
status: PendingAsyncToolStatus; |
- |
result? |
result?: ToolResult; |
- |
error? |
error?: Error; |
- |
PortableToolDescriptor interface
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
Properties
| Property | Type | Description |
|---|---|---|
code |
code: string; |
- |
message |
message: string; |
- |
retryable? |
retryable?: boolean; |
- |
RemoteToolExecutionRequest interface
Properties
| Property | Type | Description |
|---|---|---|
protocolVersion |
protocolVersion: AgentPackageProtocolVersion; |
- |
packageId |
packageId: string; |
- |
requestId |
requestId: string; |
- |
toolName |
toolName: string; |
- |
arguments |
arguments: Record<string, unknown>; |
- |
RemoteToolTransport interface
Host-supplied authenticated transport. OneRingAI owns the wire DTO and proxy tool behavior.
Methods
execute()
execute(
request: RemoteToolExecutionRequest,
options?: { signal?: AbortSignal },
): Promise<RemoteToolExecutionResponse>;
Parameters:
request:RemoteToolExecutionRequestoptions:{ signal?: AbortSignal | undefined; } | undefined(optional)
Returns: Promise<RemoteToolExecutionResponse>
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
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()
createAgent(): Agent | Promise<Agent>;
Returns: Agent | Promise<Agent>
resolveExecution()?
resolveExecution?(args: Record<string, unknown>, context: ToolContext | undefined): ExecutionBinding;
Parameters:
args:Record<string, unknown>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
Properties
| Property | Type | Description |
|---|---|---|
enabled |
enabled: Record<string, boolean>; |
- |
namespaces |
namespaces: Record<string, string>; |
- |
priorities |
priorities: Record<string, number>; |
- |
permissions? |
permissions?: Record<string, ToolPermissionConfig>; |
Permission configs by tool name |
tags? |
tags?: Record<string, string[]>; |
Tags by tool name |
categories? |
categories?: Record<string, string>; |
Categories by tool name |
sources? |
sources?: Record<string, ToolSource>; |
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
targetUserschema parameter is OMITTED and this value is always used. - When unset: existing behavior (LLM supplies
targetUserfor app-only auth). - Silently ignored for delegated connectors (identity already bound by token). |
ShellToolConfig interface
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<string, string>; |
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
Properties
| Property | Type | Description |
|---|---|---|
type |
`type: 'mode' | 'context' |
predicate |
predicate: (context: ToolSelectionContext) => 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<string, string>; |
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:
context.accountId— explicit per-tool binding (multi-account wrapper)context.connectorAccounts[connectorName]— per-connector binding (this field)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<string, ToolCall>; |
- |
pendingNonBlocking |
pendingNonBlocking: Set<string>; |
- |
completedResults |
completedResults: Map<string, ToolResult>; |
- |
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) => void; |
Host observer for the initial outcome; exceptions do not affect execution. |
onEvidence? |
onEvidence?: (evidence: ToolEvidenceDelivery) => 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) => Promise<TResult>; |
- |
idempotency? |
idempotency?: ToolIdempotency; |
- |
output? |
output?: ToolOutputHints; |
- |
permission? |
permission?: ToolPermissionConfig; |
Permission settings for this tool. If not set, defaults are used. |
descriptionFactory? |
descriptionFactory?: (context?: ToolContext) => 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) => 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
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
Properties
| Property | Type | Description |
|---|---|---|
totalTools |
totalTools: number; |
- |
enabledTools |
enabledTools: number; |
- |
disabledTools |
disabledTools: number; |
- |
namespaces |
namespaces: string[]; |
- |
toolsByNamespace |
toolsByNamespace: Record<string, number>; |
- |
mostUsed |
mostUsed: Array<{ name: string; count: number }>; |
- |
totalExecutions |
totalExecutions: number; |
- |
ToolMetadata interface
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<ToolCall>; |
- |
skip? |
skip?: boolean; |
- |
mockResult? |
mockResult?: any; |
- |
reason? |
reason?: string; |
- |
ToolOptions interface
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) => 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
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<CircuitBreakerConfig>; |
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<string, unknown>; |
- |
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<{ base64: string; mediaType: string }>; |
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<Record<string, unknown>>; |
- |
status? |
`status?: 'in_progress' | 'completed' |
ToolSelectionContext interface
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<string, unknown>; |
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
type DefaultAllowlistedTool = (typeof DEFAULT_ALLOWLIST)[number]
DesktopToolName type
📍 src/tools/desktop/types.ts:281
type DesktopToolName = (typeof DESKTOP_TOOL_NAMES)[number]
LocalToolResolver type
type LocalToolResolver = (
descriptor: PortableToolDescriptor,
) => ResolvedLocalTool | undefined | Promise<ResolvedLocalTool | undefined>
NativeToolCapability type
📍 src/domain/interfaces/IAdvancedInference.ts:31
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
type NativeToolRequest = | { capability: 'web_search'; options?: Record<string, unknown> }
| { capability: 'x_search'; options?: Record<string, unknown> }
| { capability: 'web_fetch'; options?: Record<string, unknown> }
| { capability: 'code_execution'; options?: Record<string, unknown> }
| { capability: 'file_search'; options: FileSearchOptions }
| { capability: 'remote_mcp'; server: RemoteMcpDescriptor; options?: Record<string, unknown> }
| { capability: 'computer_use'; options?: Record<string, unknown> }
| { capability: 'hosted_shell'; options?: Record<string, unknown> }
| { capability: 'apply_patch'; options?: Record<string, unknown> }
| { capability: 'tool_search'; options?: Record<string, unknown> }
| { capability: 'image_generation'; options?: Record<string, unknown> }
OpenAIRealtimeTool type
📍 src/capabilities/voice/openai/RealtimeTypes.ts:87
type OpenAIRealtimeTool = OpenAIRealtimeFunctionTool | OpenAIRealtimeMCPTool
OutcomeToolOptions type
📍 src/core/createOutcomeTool.ts:13
All ordinary tool options, with an explicitly selected invocation callback.
type OutcomeToolOptions = Omit<ToolFunction<TArgs, TResult>, 'execute'> & {
execute: (args: TArgs, invocation: OutcomeInvocation) => Promise<TResult>;
}
PendingAsyncToolStatus type
📍 src/domain/entities/Tool.ts:146
Status of a pending async tool execution
type PendingAsyncToolStatus = 'running' | 'completed' | 'failed' | 'timeout' | 'cancelled'
PortableToolPermissionResolver type
type PortableToolPermissionResolver = (
descriptor: PortableToolDescriptor,
) => ToolPermissionConfig | undefined
PortableToolPlacement type
type PortableToolPlacement = 'local' | 'remote'
PortableToolPlacementResolver type
type PortableToolPlacementResolver = (
toolName: string,
definition: FunctionToolDefinition,
) => PortableToolPlacement | 'omit'
RemoteToolExecutionResponse type
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.
type ServiceToolFactory = (
connector: Connector,
userId?: string,
options?: ServiceToolFactoryOptions,
) => ToolFunction[]
Tool type
📍 src/domain/entities/Tool.ts:63
type Tool = FunctionToolDefinition | FreeformToolDefinition | BuiltInTool
ToolCallOutputContent type
📍 src/domain/entities/Message.ts:59
Top-level function result item for Responses continuations.
type ToolCallOutputContent = InputTextContent | InputImageContent | InputFileContent
ToolCategory type
📍 src/tools/registry.generated.ts:52
Tool category for grouping
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
type ToolCategoryScope = | string[] // shorthand allowlist
| { include: string[] } // explicit allowlist
| { exclude: string[] }
ToolManagerEvent type
type ToolManagerEvent = | 'tool:registered'
| 'tool:unregistered'
| 'tool:enabled'
| 'tool:disabled'
| 'tool:executed'
| 'tool:outcome'
| 'tool:late-complete'
| 'namespace:enabled'
| 'namespace:disabled'
ToolSource type
Source identifier for a registered tool
type ToolSource = 'built-in' | 'connector' | 'custom' | 'mcp' | string
buildOrchestrationTools function
📍 src/core/orchestrator/tools.ts:170
export function buildOrchestrationTools(ctx: OrchestrationToolsContext): ToolFunction[]
createAddReactionTool function
📍 src/tools/slack/addReaction.ts:27
export function createAddReactionTool(
connector: Connector,
userId?: string
): ToolFunction<AddReactionArgs, SlackAddReactionResult>
createAgentPackageOutcomeTools function
📍 src/portable/OutcomeClient.ts:247
export async function createAgentPackageOutcomeTools(input: OutcomeAgentPackage, options: AgentPackageOutcomeToolOptions): Promise<AgentPackageOutcomeTools>
createBashTool function
Create a Bash tool with the given configuration
export function createBashTool(config: ShellToolConfig = {}): ToolFunction<BashArgs, BashResult>
createCreatePRTool function
📍 src/tools/github/createPR.ts:46
Create a GitHub create_pr tool
export function createCreatePRTool(
connector: Connector,
userId?: string
): ToolFunction<CreatePRArgs, GitHubCreatePRResult>
createCustomToolDelete function
📍 src/tools/custom-tools/customToolDelete.ts:20
export function createCustomToolDelete(storage?: ICustomToolStorage): ToolFunction<DeleteArgs, DeleteResult>
createCustomToolDraft function
📍 src/tools/custom-tools/customToolDraft.ts:43
export function createCustomToolDraft(): ToolFunction<DraftArgs, DraftResult>
createCustomToolList function
📍 src/tools/custom-tools/customToolList.ts:24
export function createCustomToolList(storage?: ICustomToolStorage): ToolFunction<ListArgs, ListResult>
createCustomToolLoad function
📍 src/tools/custom-tools/customToolLoad.ts:21
export function createCustomToolLoad(storage?: ICustomToolStorage): ToolFunction<LoadArgs, LoadResult>
createCustomToolMetaTools function
📍 src/tools/custom-tools/factories.ts:37
Create all 6 custom tool meta-tools as an array.
export function createCustomToolMetaTools(options?: CustomToolMetaToolsOptions): ToolFunction[]
Example:
const agent = Agent.create({
connector: 'openai',
model: 'gpt-4',
tools: [
...createCustomToolMetaTools(),
...otherTools,
],
});
createCustomToolSave function
📍 src/tools/custom-tools/customToolSave.ts:32
export function createCustomToolSave(storage?: ICustomToolStorage): ToolFunction<SaveArgs, SaveResult>
createCustomToolTest function
📍 src/tools/custom-tools/customToolTest.ts:32
export function createCustomToolTest(): ToolFunction<TestArgs, TestResult>
createDesktopGetCursorTool function
📍 src/tools/desktop/getCursor.ts:12
export function createDesktopGetCursorTool(config?: DesktopToolConfig): ToolFunction<Record<string, never>, DesktopGetCursorResult>
createDesktopGetScreenSizeTool function
📍 src/tools/desktop/getScreenSize.ts:11
export function createDesktopGetScreenSizeTool(config?: DesktopToolConfig): ToolFunction<Record<string, never>, DesktopGetScreenSizeResult>
createDesktopKeyboardKeyTool function
📍 src/tools/desktop/keyboardKey.ts:12
export function createDesktopKeyboardKeyTool(config?: DesktopToolConfig): ToolFunction<DesktopKeyboardKeyArgs, DesktopKeyboardKeyResult>
createDesktopKeyboardTypeTool function
📍 src/tools/desktop/keyboardType.ts:12
export function createDesktopKeyboardTypeTool(config?: DesktopToolConfig): ToolFunction<DesktopKeyboardTypeArgs, DesktopKeyboardTypeResult>
createDesktopMouseClickTool function
📍 src/tools/desktop/mouseClick.ts:13
export function createDesktopMouseClickTool(config?: DesktopToolConfig): ToolFunction<DesktopMouseClickArgs, DesktopMouseClickResult>
createDesktopMouseDragTool function
📍 src/tools/desktop/mouseDrag.ts:12
export function createDesktopMouseDragTool(config?: DesktopToolConfig): ToolFunction<DesktopMouseDragArgs, DesktopMouseDragResult>
createDesktopMouseMoveTool function
📍 src/tools/desktop/mouseMove.ts:13
export function createDesktopMouseMoveTool(config?: DesktopToolConfig): ToolFunction<DesktopMouseMoveArgs, DesktopMouseMoveResult>
createDesktopMouseScrollTool function
📍 src/tools/desktop/mouseScroll.ts:12
export function createDesktopMouseScrollTool(config?: DesktopToolConfig): ToolFunction<DesktopMouseScrollArgs, DesktopMouseScrollResult>
createDesktopScreenshotTool function
📍 src/tools/desktop/screenshot.ts:12
export function createDesktopScreenshotTool(config?: DesktopToolConfig): ToolFunction<DesktopScreenshotArgs, DesktopScreenshotResult>
createDesktopWindowFocusTool function
📍 src/tools/desktop/windowFocus.ts:11
export function createDesktopWindowFocusTool(config?: DesktopToolConfig): ToolFunction<DesktopWindowFocusArgs, DesktopWindowFocusResult>
createDesktopWindowListTool function
📍 src/tools/desktop/windowList.ts:11
export function createDesktopWindowListTool(config?: DesktopToolConfig): ToolFunction<Record<string, never>, DesktopWindowListResult>
createDraftEmailTool function
📍 src/tools/microsoft/createDraftEmail.ts:36
Create a Microsoft Graph create_draft_email tool
export function createDraftEmailTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<CreateDraftEmailArgs, MicrosoftDraftEmailResult>
createEditFileTool function
📍 src/tools/filesystem/editFile.ts:42
Create an Edit File tool with the given configuration
export function createEditFileTool(config: FilesystemToolConfig = {}): ToolFunction<EditFileArgs, EditFileResult>
createEditMeetingTool function
📍 src/tools/microsoft/editMeeting.ts:39
Create a Microsoft Graph edit_meeting tool
export function createEditMeetingTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<EditMeetingArgs, MicrosoftEditMeetingResult>
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.
export function createExecuteJavaScriptTool(
options?: ExecuteJavaScriptToolOptions,
): ToolFunction<ExecuteJSArgs, ExecuteJSResult>
createFindEntityTool function
📍 src/tools/memory/findEntity.ts:65
export function createFindEntityTool(
deps: MemoryToolDeps,
): ToolFunction<FindEntityArgs>
createFindMeetingSlotsTool function
📍 src/tools/microsoft/findMeetingSlots.ts:37
Create a Microsoft Graph find_meeting_slots tool
export function createFindMeetingSlotsTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<FindMeetingSlotsArgs, MicrosoftFindSlotsResult>
createForgetTool function
📍 src/tools/memory/forget.ts:56
export function createForgetTool(deps: MemoryToolDeps): ToolFunction<ForgetArgs>
createGetChannelInfoTool function
📍 src/tools/slack/getChannelInfo.ts:24
export function createGetChannelInfoTool(
connector: Connector,
userId?: string
): ToolFunction<GetChannelInfoArgs, SlackGetChannelInfoResult>
createGetMeetingTranscriptTool function
📍 src/tools/microsoft/getMeetingTranscript.ts:57
Create a Microsoft Graph get_meeting_transcript tool
export function createGetMeetingTranscriptTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<GetMeetingTranscriptArgs, MicrosoftGetTranscriptResult>
createGetMentionsTool function
📍 src/tools/slack/getMentions.ts:30
export function createGetMentionsTool(
connector: Connector,
userId?: string
): ToolFunction<GetMentionsArgs, SlackGetMentionsResult>
createGetMessagesTool function
📍 src/tools/slack/getMessages.ts:31
export function createGetMessagesTool(
connector: Connector,
userId?: string
): ToolFunction<GetMessagesArgs, SlackGetMessagesResult>
createGetMessageTool function
📍 src/tools/twilio/getMessage.ts:23
export function createGetMessageTool(
connector: Connector,
userId?: string
): ToolFunction<GetMessageArgs, TwilioGetMessageResult>
createGetPRTool function
📍 src/tools/github/getPR.ts:31
Create a GitHub get_pr tool
export function createGetPRTool(
connector: Connector,
userId?: string
): ToolFunction<GetPRArgs, GitHubGetPRResult>
createGetThreadTool function
📍 src/tools/slack/getThread.ts:28
export function createGetThreadTool(
connector: Connector,
userId?: string
): ToolFunction<GetThreadArgs, SlackGetThreadResult>
createGetUsersTool function
📍 src/tools/slack/getUsers.ts:43
export function createGetUsersTool(
connector: Connector,
userId?: string
): ToolFunction<GetUsersArgs, SlackGetUsersResult>
createGitHubReadFileTool function
📍 src/tools/github/readFile.ts:46
Create a GitHub read_file tool
export function createGitHubReadFileTool(
connector: Connector,
userId?: string
): ToolFunction<GitHubReadFileArgs, GitHubReadFileResult>
createGlobTool function
📍 src/tools/filesystem/glob.ts:100
Create a Glob tool with the given configuration
export function createGlobTool(config: FilesystemToolConfig = {}): ToolFunction<GlobArgs, GlobResult>
createGraphTool function
📍 src/tools/memory/graph.ts:123
export function createGraphTool(deps: MemoryToolDeps): ToolFunction<GraphArgs>
createGrepTool function
📍 src/tools/filesystem/grep.ts:181
Create a Grep tool with the given configuration
export function createGrepTool(config: FilesystemToolConfig = {}): ToolFunction<GrepArgs, GrepResult>
createLinkTool function
export function createLinkTool(deps: MemoryToolDeps): ToolFunction<LinkArgs>
createListBranchesTool function
📍 src/tools/github/listBranches.ts:43
Create a GitHub list_branches tool
export function createListBranchesTool(
connector: Connector,
userId?: string
): ToolFunction<ListBranchesArgs, GitHubListBranchesResult>
createListChannelsTool function
📍 src/tools/slack/listChannels.ts:27
export function createListChannelsTool(
connector: Connector,
userId?: string
): ToolFunction<ListChannelsArgs, SlackListChannelsResult>
createListDirectoryTool function
📍 src/tools/filesystem/listDirectory.ts:139
Create a List Directory tool with the given configuration
export function createListDirectoryTool(config: FilesystemToolConfig = {}): ToolFunction<ListDirectoryArgs, ListDirectoryResult>
createListFactsTool function
📍 src/tools/memory/listFacts.ts:59
export function createListFactsTool(deps: MemoryToolDeps): ToolFunction<ListFactsArgs>
createListMessagesTool function
📍 src/tools/twilio/listMessages.ts:35
export function createListMessagesTool(
connector: Connector,
userId?: string
): ToolFunction<ListMessagesArgs, TwilioListMessagesResult>
createMeetingTool function
📍 src/tools/microsoft/createMeeting.ts:38
Create a Microsoft Graph create_meeting tool
export function createMeetingTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<CreateMeetingArgs, MicrosoftCreateMeetingResult>
createMicrosoftListFilesTool function
📍 src/tools/microsoft/listFiles.ts:48
export function createMicrosoftListFilesTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<ListFilesArgs, MicrosoftListFilesResult>
createMicrosoftReadFileTool function
📍 src/tools/microsoft/readFile.ts:56
export function createMicrosoftReadFileTool(
connector: Connector,
userId?: string,
config?: MicrosoftReadFileConfig,
actAs?: string,
): ToolFunction<ReadFileArgs, MicrosoftReadFileResult>
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.
export function createMicrosoftSearchFilesTool(
connector: Connector,
userId?: string,
): ToolFunction<SearchFilesArgs, MicrosoftSearchFilesResult>
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().
export function createOutcomeTool<TArgs = any, TResult = any>(
options: OutcomeToolOptions<TArgs, TResult>,
): ToolFunction<TArgs, TResult>
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.
export function createPortableToolImplementationFingerprint(
definition: PortableToolDescriptor['definition'],
implementationId: string,
): string
createPostMessageTool function
📍 src/tools/slack/postMessage.ts:31
export function createPostMessageTool(
connector: Connector,
userId?: string
): ToolFunction<PostMessageArgs, SlackPostMessageResult>
createPRCommentsTool function
📍 src/tools/github/prComments.ts:35
Create a GitHub pr_comments tool
export function createPRCommentsTool(
connector: Connector,
userId?: string
): ToolFunction<PRCommentsArgs, GitHubPRCommentsResult>
createPRFilesTool function
📍 src/tools/github/prFiles.ts:31
Create a GitHub pr_files tool
export function createPRFilesTool(
connector: Connector,
userId?: string
): ToolFunction<PRFilesArgs, GitHubPRFilesResult>
createReadFileTool function
📍 src/tools/filesystem/readFile.ts:47
Create a Read File tool with the given configuration
export function createReadFileTool(config: FilesystemToolConfig = {}): ToolFunction<ReadFileArgs, ReadFileResult>
createRecallTool function
📍 src/tools/memory/recall.ts:43
export function createRecallTool(deps: MemoryToolDeps): ToolFunction<RecallArgs>
createRememberTool function
📍 src/tools/memory/remember.ts:77
export function createRememberTool(deps: MemoryToolDeps): ToolFunction<RememberArgs>
createRemoteTool function
📍 src/portable/AgentPackage.ts:392
Build a normal ToolFunction whose execution is delegated through a typed transport.
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.
export function createRequestUserInputTool(
delivery: IUserInteractionDelivery,
options: CreateRequestUserInputToolOptions = {},
): ToolFunction<RequestUserInputToolArgs, SuspendSignal>
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.
export function createResolvedLocalTool(
tool: ToolFunction,
implementationId?: string,
): ResolvedLocalTool
createRestoreTool function
📍 src/tools/memory/restore.ts:27
export function createRestoreTool(deps: MemoryToolDeps): ToolFunction<RestoreArgs>
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
export function createRoutineTool(options: CreateRoutineToolOptions): ToolFunction
createSearchCodeTool function
📍 src/tools/github/searchCode.ts:104
Create a GitHub search_code tool
export function createSearchCodeTool(
connector: Connector,
userId?: string
): ToolFunction<SearchCodeArgs, GitHubSearchCodeResult>
createSearchFilesTool function
📍 src/tools/github/searchFiles.ts:58
Create a GitHub search_files tool
export function createSearchFilesTool(
connector: Connector,
userId?: string
): ToolFunction<SearchFilesArgs, GitHubSearchFilesResult>
createSearchMessagesTool function
📍 src/tools/slack/searchMessages.ts:29
export function createSearchMessagesTool(
connector: Connector,
userId?: string
): ToolFunction<SearchMessagesArgs, SlackSearchMessagesResult>
createSearchTool function
📍 src/tools/memory/search.ts:48
export function createSearchTool(deps: MemoryToolDeps): ToolFunction<SearchArgs>
createSendEmailTool function
📍 src/tools/microsoft/sendEmail.ts:38
Create a Microsoft Graph send_email tool
export function createSendEmailTool(
connector: Connector,
userId?: string,
actAs?: string,
): ToolFunction<SendEmailArgs, MicrosoftSendEmailResult>
createSendSMSTool function
📍 src/tools/twilio/sendSMS.ts:30
export function createSendSMSTool(
connector: Connector,
userId?: string
): ToolFunction<SendSMSArgs, TwilioSendResult>
createSendWhatsAppTool function
📍 src/tools/twilio/sendWhatsApp.ts:37
export function createSendWhatsAppTool(
connector: Connector,
userId?: string
): ToolFunction<SendWhatsAppArgs, TwilioSendResult>
createSetAgentRuleTool function
📍 src/tools/memory/setAgentRule.ts:102
export function createSetAgentRuleTool(deps: MemoryToolDeps): ToolFunction<SetAgentRuleArgs>
createSetChannelTopicTool function
📍 src/tools/slack/setChannelTopic.ts:25
export function createSetChannelTopicTool(
connector: Connector,
userId?: string
): ToolFunction<SetChannelTopicArgs, SlackSetChannelTopicResult>
createSpeechToTextTool function
📍 src/tools/multimedia/speechToText.ts:31
export function createSpeechToTextTool(
connector: Connector,
storage?: IMediaStorage,
): ToolFunction<SpeechToTextArgs, SpeechToTextResult>
createTextToSpeechTool function
📍 src/tools/multimedia/textToSpeech.ts:33
export function createTextToSpeechTool(
connector: Connector,
storage?: IMediaStorage,
userId?: string
): ToolFunction<TextToSpeechArgs, TextToSpeechResult>
createUpsertEntityTool function
📍 src/tools/memory/upsertEntity.ts:113
export function createUpsertEntityTool(
deps: MemoryToolDeps,
): ToolFunction<UpsertEntityArgs>
createWriteFileTool function
📍 src/tools/filesystem/writeFile.ts:38
Create a Write File tool with the given configuration
export function createWriteFileTool(config: FilesystemToolConfig = {}): ToolFunction<WriteFileArgs, WriteFileResult>
defaultDescribeCall function
📍 src/domain/entities/Tool.ts:315
Default implementation for describeCall. Shows the first meaningful argument value.
export function defaultDescribeCall(
args: Record<string, unknown>,
maxLength = 60
): string
Example:
defaultDescribeCall({ file_path: '/path/to/file.ts' })
// Returns: '/path/to/file.ts'
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.
export function generateWebAPITool(): ToolFunction<APIRequestArgs, APIRequestResult>
getAllBuiltInTools function
📍 src/tools/registry.generated.ts:473
Get all built-in tools as ToolFunction array
export function getAllBuiltInTools(): ToolFunction[]
getConnectorTools function
📍 src/connectors/vendors/helpers.ts:513
Get all tools for a connector (delegates to ConnectorTools)
export function getConnectorTools(connectorName: string): ToolFunction[]
getToolByName function
📍 src/tools/registry.generated.ts:488
Get tool by name
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.
export function getToolCallDescription<TArgs>(
tool: ToolFunction<TArgs>,
args: TArgs
): string
getToolCategories function
📍 src/tools/registry.generated.ts:498
Get all unique category names
export function getToolCategories(): ToolCategory[]
getToolRegistry function
📍 src/tools/registry.generated.ts:478
Get full tool registry with metadata
export function getToolRegistry(): ToolRegistryEntry[]
getToolsByCategory function
📍 src/tools/registry.generated.ts:483
Get tools by category
export function getToolsByCategory(category: ToolCategory): ToolRegistryEntry[]
getToolsRequiringConnector function
📍 src/tools/registry.generated.ts:493
Get tools that require connector configuration
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
inputin the VM sandbox - Gets connector registry from ToolContext for authenticatedFetch
- Has session-scoped permission with medium risk level
export function hydrateCustomTool(
definition: CustomToolDefinition,
options?: HydrateOptions,
): ToolFunction
isToolCallArgumentsDelta function
📍 src/domain/entities/StreamEvent.ts:366
export function isToolCallArgumentsDelta(
event: StreamEvent
): event is ToolCallArgumentsDeltaEvent
isToolCallArgumentsDone function
📍 src/domain/entities/StreamEvent.ts:372
export function isToolCallArgumentsDone(
event: StreamEvent
): event is ToolCallArgumentsDoneEvent
isToolCallStart function
📍 src/domain/entities/StreamEvent.ts:362
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.
export function registerRoutineToolCategory(options: RoutineToolCatalogOptions): void
Example:
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.
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.
function sanitizeToolName(name: string): string
sanitizeToolName function
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
export function sanitizeToolName(name: string): string