openai-client-base 0.12.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};

/// McpListToolsTool : A tool available on an MCP server.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, bon::Builder)]
pub struct McpListToolsTool {
    /// The name of the tool.
    #[serde(rename = "name")]
    pub name: String,
    /// The description of the tool.
    #[serde(
        rename = "description",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub description: Option<Option<String>>,
    /// The JSON schema describing the tool's input.
    #[serde(rename = "input_schema")]
    pub input_schema: serde_json::Value,
    /// Additional annotations about the tool.
    #[serde(
        rename = "annotations",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub annotations: Option<Option<serde_json::Value>>,
}

impl McpListToolsTool {
    /// A tool available on an MCP server.
    pub fn new(name: String, input_schema: serde_json::Value) -> McpListToolsTool {
        McpListToolsTool {
            name,
            description: None,
            input_schema,
            annotations: None,
        }
    }
}

impl std::fmt::Display for McpListToolsTool {
    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),
        }
    }
}