Skip to main content

gadk_session/
tool_confirmation.rs

1// Copyright 2026 Chris Olson
2// Portions derived from ADK-Go (https://github.com/google/adk-go), Copyright 2026 Google LLC.
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//     http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16//! The confirmation a tool asks of the user before it runs.
17
18use serde::{Deserialize, Serialize};
19use serde_json::Value;
20
21/// The state and details of a user confirmation request for a tool execution.
22#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
23pub struct ToolConfirmation {
24    /// Message explaining to the user why confirmation is needed.
25    #[serde(default)]
26    pub hint: String,
27    /// The user's decision: `true` if approved.
28    #[serde(default)]
29    pub confirmed: bool,
30    /// Application-specific data related to the request (`None` encodes as `null`).
31    #[serde(default)]
32    pub payload: Option<Value>,
33}