ToolContext Type
Runtime context handed to a tool's Execute (and to the orchestrator) so it can request approval for sensitive resource access dynamically — based on its own input or intermediate results — locate the session's file folder, and launch background work. The runtime builds one per session/turn and threads it explicitly; library and test code can use `ToolContext.allowAll`.
Record fields
| Record Field |
Description
|
|
Names of agents flagged async. When the orchestrator delegates to one of these, it spawns a background task (a sub-session) instead of running it inline.
|
Full Usage:
FilesKey
Field type: string
|
Session key whose file folder backs file operations in this context. Usually the same as SessionKey, but a task sub-session points this at its parent session so the user's attachments and the files the task generates share one folder.
|
|
Request approval to access a resource, with a human-readable reason. The final argument forces an interactive prompt even for resources that would otherwise be auto-allowed (e.g. paths inside the workspace sandbox); already-granted rules still suppress the prompt. Returns true when allowed. The runtime answers from already-granted session/global rules or by prompting the user live.
|
Full Usage:
SessionKey
Field type: string
|
The session this execution belongs to ("userId/sessionId"); "" when unscoped.
|
Full Usage:
TurnId
Field type: string
|
Id of the turn currently being processed ("" when none).
|
Nao