toTool
function toTool(action, context): Tool;Defined in: core/src/action/action.tool.ts:18
Bind a server Action into a neutral Tool by closing over the
Services container. The resulting tool carries the same schemas and runs
action.execute with services supplied — so the sandbox and agent can drive
it without ever seeing a Services. A ToolInterrupt thrown by the
action propagates unchanged (an action’s interrupt is a ToolInterrupt).
Built as a plain object rather than via defineTool: defineAction already
validates input/output at the action boundary, so wrapping again would parse
twice on every call.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
action |
Action |
context |
{ services: Services; } |
context.services |
Services |