Skip to content

Commit 66bdbcd

Browse files
committed
reusable type
1 parent 1fbd6a2 commit 66bdbcd

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

async-openai/src/types/mcp.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,17 @@ pub struct MCPToolApprovalFilter {
121121
#[serde(skip_serializing_if = "Option::is_none")]
122122
pub never: Option<MCPToolFilter>,
123123
}
124+
125+
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
126+
pub struct MCPListToolsTool {
127+
/// The JSON schema describing the tool's input.
128+
pub input_schema: serde_json::Value,
129+
/// The name of the tool.
130+
pub name: String,
131+
/// Additional annotations about the tool.
132+
#[serde(skip_serializing_if = "Option::is_none")]
133+
pub annotations: Option<serde_json::Value>,
134+
/// The description of the tool.
135+
#[serde(skip_serializing_if = "Option::is_none")]
136+
pub description: Option<String>,
137+
}

async-openai/src/types/realtime/conversation_item.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use serde::{Deserialize, Serialize};
22

33
use crate::types::{
4+
mcp::MCPListToolsTool,
45
realtime::{ErrorCodeMessage, ErrorMessage},
5-
responses::MCPListToolsTool,
66
};
77

88
#[derive(Debug, Serialize, Deserialize, Clone)]

async-openai/src/types/responses/response.rs

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
use crate::error::OpenAIError;
2-
use crate::types::MCPTool;
32
pub use crate::types::{
43
CompletionTokensDetails, ImageDetail, PromptTokensDetails, ReasoningEffort,
54
ResponseFormatJsonSchema,
65
};
6+
use crate::types::{MCPListToolsTool, MCPTool};
77
use derive_builder::Builder;
8-
use futures::Stream;
98
use serde::{Deserialize, Serialize};
109
use std::collections::HashMap;
11-
use std::pin::Pin;
1210

1311
/// Role of messages in the API.
1412
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
@@ -2107,20 +2105,6 @@ pub struct MCPListTools {
21072105
pub error: Option<String>,
21082106
}
21092107

2110-
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
2111-
pub struct MCPListToolsTool {
2112-
/// The JSON schema describing the tool's input.
2113-
pub input_schema: serde_json::Value,
2114-
/// The name of the tool.
2115-
pub name: String,
2116-
/// Additional annotations about the tool.
2117-
#[serde(skip_serializing_if = "Option::is_none")]
2118-
pub annotations: Option<serde_json::Value>,
2119-
/// The description of the tool.
2120-
#[serde(skip_serializing_if = "Option::is_none")]
2121-
pub description: Option<String>,
2122-
}
2123-
21242108
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
21252109
pub struct MCPApprovalRequest {
21262110
/// JSON string of arguments for the tool.

0 commit comments

Comments
 (0)