Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/goose/src/agents/extension_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -973,9 +973,14 @@ impl ExtensionManager {
// Loop through each extension and try to read the resource, don't raise an error if the resource is not found
// TODO: do we want to find if a provided uri is in multiple extensions?
// currently it will return the first match and skip any others

// Collect extension names first to avoid holding the lock during iteration
let extension_names: Vec<String> = self.extensions.lock().await.keys().cloned().collect();
let extension_names: Vec<String> = self
.extensions
.lock()
.await
.iter()
.filter(|(_name, ext)| ext.supports_resources())
.map(|(name, _)| name.clone())
.collect();

for extension_name in extension_names {
let read_result = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ in your tool specification.

## test

test supports resources, you can use platform__read_resource,
and platform__list_resources on this extension.
test supports resources, you can use extensionmanager__read_resource,
and extensionmanager__list_resources on this extension.
### Instructions
how to use this extension

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ in your tool specification.

## extension_A

extension_A supports resources, you can use platform__read_resource,
and platform__list_resources on this extension.
extension_A supports resources, you can use extensionmanager__read_resource,
and extensionmanager__list_resources on this extension.
### Instructions
<instructions on how to use extension A>
## extension_B
Expand Down
4 changes: 2 additions & 2 deletions crates/goose/src/prompts/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ in your tool specification.
## {{extension.name}}

{% if extension.has_resources %}
{{extension.name}} supports resources, you can use platform__read_resource,
and platform__list_resources on this extension.
{{extension.name}} supports resources, you can use extensionmanager__read_resource,
and extensionmanager__list_resources on this extension.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment, even with platform__read_resource in the system prompt , LLM is smart to call extensionmanager__read_resource tool. However, it is better to update with proper extension name.

{% endif %}
{% if extension.instructions %}### Instructions
{{extension.instructions}}{% endif %}
Expand Down
Loading