fix: fix OpenAPI build (#2036)

This commit is contained in:
Alex Hancock
2025-04-04 11:58:57 -04:00
committed by GitHub
parent c3042067a0
commit 3ec0f77ed5
7 changed files with 183 additions and 3 deletions
+3
View File
@@ -5,6 +5,7 @@ use goose::agents::ExtensionConfig;
use goose::config::ExtensionEntry;
use goose::providers::base::ConfigKey;
use goose::providers::base::ProviderMetadata;
use mcp_core::tool::{Tool, ToolAnnotations};
#[allow(dead_code)] // Used by utoipa for OpenAPI generation
#[derive(OpenApi)]
@@ -32,6 +33,8 @@ use goose::providers::base::ProviderMetadata;
ExtensionConfig,
ConfigKey,
Envs,
Tool,
ToolAnnotations,
))
)]
pub struct ApiDoc;
+2 -1
View File
@@ -1,6 +1,7 @@
use std::collections::HashMap;
use mcp_client::client::Error as ClientError;
use mcp_core::tool::Tool;
use serde::{Deserialize, Serialize};
use thiserror::Error;
use tracing::warn;
@@ -155,7 +156,7 @@ pub enum ExtensionConfig {
/// The name used to identify this extension
name: String,
/// The tools provided by the frontend
tools: Vec<mcp_core::tool::Tool>,
tools: Vec<Tool>,
/// Instructions for how to use these tools
instructions: Option<String>,
},
+1
View File
@@ -13,6 +13,7 @@ anyhow = "1.0"
chrono = { version = "0.4.38", features = ["serde"] }
url = "2.5"
base64 = "0.21"
utoipa = "4.1"
[dev-dependencies]
tempfile = "3.8"
+3 -2
View File
@@ -2,6 +2,7 @@
/// Tool calls represent requests from the client to execute one
use serde::{Deserialize, Serialize};
use serde_json::Value;
use utoipa::ToSchema;
/// Additional properties describing a tool to clients.
///
@@ -11,7 +12,7 @@ use serde_json::Value;
///
/// Clients should never make tool use decisions based on ToolAnnotations
/// received from untrusted servers.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct ToolAnnotations {
/// A human-readable title for the tool.
@@ -100,7 +101,7 @@ impl ToolAnnotations {
}
/// A tool that can be used by a model.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ToSchema)]
#[serde(rename_all = "camelCase")]
pub struct Tool {
/// The name of the tool