mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix: support unprefixed tools in code_execution extension
The load_callback_configs function was failing when encountering unprefixed tools (like summon's load/delegate) because it expected all tool names to contain '__'. Now uses get_tool_owner() to get the namespace for unprefixed tools, making them available in code execution mode as Summon.load() and Summon.delegate().
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::agents::extension::PlatformExtensionContext;
|
||||
use crate::agents::extension_manager::get_tool_owner;
|
||||
use crate::agents::mcp_client::{Error, McpClientTrait};
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
@@ -111,10 +112,16 @@ impl CodeExecutionClient {
|
||||
let mut cfgs = vec![];
|
||||
for tool in tools {
|
||||
let full_name = tool.name.to_string();
|
||||
let (server_name, tool_name) = full_name.split_once("__")?;
|
||||
let (namespace, name) = if let Some((server, tool_name)) = full_name.split_once("__") {
|
||||
(server.to_string(), tool_name.to_string())
|
||||
} else if let Some(owner) = get_tool_owner(&tool) {
|
||||
(owner, full_name)
|
||||
} else {
|
||||
continue;
|
||||
};
|
||||
cfgs.push(CallbackConfig {
|
||||
name: tool_name.into(),
|
||||
namespace: server_name.into(),
|
||||
name,
|
||||
namespace,
|
||||
description: tool.description.as_ref().map(|d| d.to_string()),
|
||||
input_schema: Some(json!(tool.input_schema)),
|
||||
output_schema: tool.output_schema.as_ref().map(|s| json!(s)),
|
||||
|
||||
Reference in New Issue
Block a user