Reference
?

session

The originating call's context inside a voice tool method: its id, medium, and phone numbers.
session → { channel, voiceSessionId?, medium?, sip?, visitorId? }

The context of the call a voice tool is answering, read from the session import inside the method. voiceSessionId is the call's stable id, the same one the browser client holds and the call log keys on, so a tool can write its results against the exact call. medium says whether the call is on the web or a phone, which is how a tool answers with a screen in mind or in speech alone, and sip carries the numbers on a phone call as context, never as identity. The same object serves agent-chat tool calls, where channel is 'agent' and a threadId stands in for the call id.

Parameters
channel
'voice' | 'agent' | 'web' | 'api'
Which surface invoked the method. 'voice' for a voice tool call.
voiceSessionId
string
The live call's id. Matches the browser client's session.sessionId and the call log, so results can be keyed to the exact call.
medium
'web' | 'phone-in' | 'phone-out'
How the call arrived. Branch behavior that assumes a screen; a phone call has none. Treat absent as 'web'.
sip
{ to, fromNumber }
Phone calls only: the numbers on the call. Context only, never identity, since caller ID is spoofable.
visitorId
string
Stable visitor key, present for anonymous and signed-in sessions alike.
Answer differently on a phone
import { session } from '@mindstudio-ai/agent';

export async function orderStatus(input: { id: string }) {
  const order = await Orders.get(input.id);
  // A phone call has no screen: return only what can be said aloud.
  if (session.medium === 'phone-in') return { spoken: summarize(order) };
  return { order };
}