Interface ReplyObject

Source
Expand description

A structured reply. Text, reasoning, tool calls, usage, and errors are all optional.

example
server.when("hello").reply({ text: "Hi!", reasoning: "Simple greeting." });
server.when("weather").reply({
tools: [{ name: "get_weather", args: { city: "London" } }],
});
interface ReplyObject {
    error?: ErrorReply;
    reasoning?: string;
    text?: string;
    tools?: readonly ToolCall[];
    usage?: { input: number; output: number };
}

Properties§

§readonly error?: ErrorReply

When set, the server responds with this HTTP error instead of a normal reply.

§readonly reasoning?: string

Extended thinking or chain-of-thought. Works with Anthropic and Responses formats.

§readonly text?: string

Text content to send back.

§readonly tools?: readonly ToolCall[]

Tool calls the model wants to make.

§readonly usage?: { ... }

Token counts to report.

defaultValue

{ input: 10, output: 5 }