openai-client-base 0.16.0

Auto-generated Rust client for the OpenAI API
/*
 * OpenAI API
 *
 * The OpenAI REST API. Please see https://platform.openai.com/docs/api-reference for more details.
 *
 * The version of the OpenAPI document: 2.3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

/// PersistedAgentToolConfigParamMcp : Tools provided by a remote MCP server without stored credentials.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct PersistedAgentToolConfigParamMcp {
    /// The type of the object. Always `mcp`.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// A label used to identify the MCP server in tool calls.
    #[serde(rename = "server_label")]
    pub server_label: String,
    /// The vault credential selected for this MCP server. Optional when exactly one attached credential matches the server URL.
    #[serde(rename = "credential_id", skip_serializing_if = "Option::is_none")]
    pub credential_id: Option<String>,
    #[serde(rename = "transport")]
    pub transport: Box<models::PersistedMcpTransportConfigParam>,
    /// Metadata included with requests to this MCP server.
    #[serde(rename = "request_metadata", skip_serializing_if = "Option::is_none")]
    pub request_metadata: Option<std::collections::HashMap<String, serde_json::Value>>,
    /// The MCP tools the agent may call. All server tools are allowed when omitted.
    #[serde(rename = "allowed_tools", skip_serializing_if = "Option::is_none")]
    pub allowed_tools: Option<Vec<String>>,
    /// Whether this MCP server must initialize before the first turn. Defaults to `false`.
    #[serde(rename = "required", skip_serializing_if = "Option::is_none")]
    pub required: Option<bool>,
    #[serde(rename = "connection_origin", skip_serializing_if = "Option::is_none")]
    pub connection_origin: Option<Box<models::PersistedAgentToolConfigParamMcpConnectionOrigin>>,
}

impl PersistedAgentToolConfigParamMcp {
    /// Tools provided by a remote MCP server without stored credentials.
    pub fn new(
        r#type: Type,
        server_label: String,
        transport: models::PersistedMcpTransportConfigParam,
    ) -> PersistedAgentToolConfigParamMcp {
        PersistedAgentToolConfigParamMcp {
            r#type,
            server_label,
            credential_id: None,
            transport: Box::new(transport),
            request_metadata: None,
            allowed_tools: None,
            required: None,
            connection_origin: None,
        }
    }
}
/// The type of the object. Always `mcp`.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "mcp")]
    Mcp,
}

impl Default for Type {
    fn default() -> Type {
        Self::Mcp
    }
}

impl std::fmt::Display for PersistedAgentToolConfigParamMcp {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match serde_json::to_string(self) {
            Ok(s) => write!(f, "{}", s),
            Err(_) => Err(std::fmt::Error),
        }
    }
}