mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix: is_error is optional per MCP schema for CallToolResult (#675)
This commit is contained in:
@@ -687,8 +687,8 @@ mod tests {
|
||||
use super::*;
|
||||
use lazy_static::lazy_static;
|
||||
use serde_json::json;
|
||||
use std::fs;
|
||||
use std::sync::Mutex;
|
||||
use std::{env, fs};
|
||||
use tempfile::TempDir;
|
||||
use tokio::sync::OnceCell;
|
||||
|
||||
|
||||
@@ -584,7 +584,7 @@ mod tests {
|
||||
match name {
|
||||
"tool" | "test__tool" => Ok(CallToolResult {
|
||||
content: vec![],
|
||||
is_error: false,
|
||||
is_error: None,
|
||||
}),
|
||||
_ => Err(Error::NotInitialized),
|
||||
}
|
||||
|
||||
@@ -218,7 +218,8 @@ pub struct ListToolsResult {
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct CallToolResult {
|
||||
pub content: Vec<Content>,
|
||||
pub is_error: bool,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub is_error: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
||||
|
||||
@@ -179,11 +179,11 @@ pub trait Router: Send + Sync + 'static {
|
||||
let result = match self.call_tool(name, arguments).await {
|
||||
Ok(result) => CallToolResult {
|
||||
content: result,
|
||||
is_error: false,
|
||||
is_error: None,
|
||||
},
|
||||
Err(err) => CallToolResult {
|
||||
content: vec![Content::text(err.to_string())],
|
||||
is_error: true,
|
||||
is_error: Some(true),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user