Signal · Tool calling

Tool call loop

When the model requests a tool call (a tool name and arguments), Signal validates the arguments against the tool’s input schema, runs execute, appends the tool result to the conversation and sends the request again; meta.toolCalls records each call. Example: seatsLeft returns 113, computed by its function and not scripted, and the model answers from it. Both model turns are scripted; no model is called.

Tool
defineTool({
  name: 'seatsLeft',
  description: 'How many seats are left on a night',
  input: z.object({ night: z.string().describe('The night, as YYYY-MM-DD') }),
  execute: ({ night }) => ({ night, left: seatsLeftOn(night) }),
})
Prompt
'How many seats are left on Saturday?'
Run, turn by turn
Scripted model reply
{
  calls: [{ name: 'seatsLeft', args: '{"night":"2026-10-24"}' }],
}
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.