serverTool
serverTool<
Input,Output>(definition):ServerTool<Input,Output>
Defined in: packages/engine/src/lib/agent-session/server-tool.ts:95
Declares a Server Tool, inferring input and output types and applying
defaults: locus server, sideEffect non_idempotent and approval
never. Register it through the tools field of the Engine agent
config.
Type Parameters
Section titled “Type Parameters”Input
Output
Section titled “Output”Output
Parameters
Section titled “Parameters”definition
Section titled “definition”ServerToolDefinition<Input, Output>
Returns
Section titled “Returns”ServerTool<Input, Output>
Example
Section titled “Example”const latestOrder = serverTool({ name: 'latest_order', description: 'Returns the latest order of the signed-in user', input: z.object({}), output: z.object({ orderId: z.string() }), sideEffect: 'read_only', execute: (_input, ctx) => orders.latestFor(ctx.user, ctx.signal), summarize: (order) => `Order ${order.orderId}`,});