Skip to main content

gproxy_protocol/protocol/claude/common/tools/
caller.rs

1use serde::{Deserialize, Serialize};
2
3use super::super::{JsonObject, TypedObject};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6#[serde(untagged)]
7pub enum Caller {
8    Direct(DirectCaller),
9    ServerTool(ServerToolCaller),
10    ServerTool20260120(ServerToolCaller20260120),
11    ServerTool20260521(ServerToolCaller20260521),
12    Unknown(TypedObject),
13}
14
15#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
16pub struct DirectCaller {
17    #[serde(rename = "type")]
18    pub type_: DirectCallerType,
19    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
20    pub extra: JsonObject,
21}
22
23#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
24pub enum DirectCallerType {
25    #[serde(rename = "direct")]
26    Direct,
27}
28
29#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
30pub struct ServerToolCaller {
31    pub tool_id: String,
32    #[serde(rename = "type")]
33    pub type_: ServerToolCallerType,
34    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
35    pub extra: JsonObject,
36}
37
38#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
39pub enum ServerToolCallerType {
40    #[serde(rename = "code_execution_20250825")]
41    CodeExecution20250825,
42}
43
44#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
45pub struct ServerToolCaller20260120 {
46    pub tool_id: String,
47    #[serde(rename = "type")]
48    pub type_: ServerToolCaller20260120Type,
49    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
50    pub extra: JsonObject,
51}
52
53#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
54pub enum ServerToolCaller20260120Type {
55    #[serde(rename = "code_execution_20260120")]
56    CodeExecution20260120,
57}
58
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60pub struct ServerToolCaller20260521 {
61    pub tool_id: String,
62    #[serde(rename = "type")]
63    pub type_: ServerToolCaller20260521Type,
64    #[serde(default, flatten, skip_serializing_if = "JsonObject::is_empty")]
65    pub extra: JsonObject,
66}
67
68#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
69pub enum ServerToolCaller20260521Type {
70    #[serde(rename = "code_execution_20260521")]
71    CodeExecution20260521,
72}