new features
This commit is contained in:
@@ -850,6 +850,17 @@ struct RemoteKnowledgeStack: Identifiable {
|
||||
let supportsInventory: Bool
|
||||
}
|
||||
|
||||
enum MCPToolResponse {
|
||||
static func check(_ data: Data, tool: String) throws {
|
||||
guard let result = (try? JSONSerialization.jsonObject(with: data)) as? [String: Any],
|
||||
result["isError"] as? Bool == true else { return }
|
||||
let content = result["content"] as? [[String: Any]] ?? []
|
||||
let details = content.compactMap { $0["text"] as? String }.joined(separator: "\n")
|
||||
let message = details.isEmpty ? "The server reported a tool error." : String(details.prefix(4_000))
|
||||
throw StudioError("\(tool) failed. \(message)")
|
||||
}
|
||||
}
|
||||
|
||||
struct MCPConnectionState {
|
||||
var toolset: ActiveToolset? = nil
|
||||
var progress: String? = nil
|
||||
|
||||
Reference in New Issue
Block a user