Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import reactor.core.publisher.Mono;
Expand Down Expand Up @@ -169,14 +170,11 @@ private String loadSkillResourceImpl(String skillId, String path) {
}

// Get resource
Map<String, String> resources = skill.getResources();
if (resources == null || !resources.containsKey(path)) {
// Resource not found, return available resource paths
throw new IllegalArgumentException(
buildResourceNotFoundMessage(skillId, path, resources));
Set<String> paths = skill.getResourcePaths();
if (paths == null || !paths.contains(path)) {
throw new IllegalArgumentException(buildResourceNotFoundMessage(skillId, path, paths));
}

String resourceContent = resources.get(path);
String resourceContent = skill.getResource(path);
activateSkill(skillId);
return buildResourceResponse(skillId, path, resourceContent);
}
Expand Down Expand Up @@ -225,11 +223,10 @@ private String buildResourceResponse(String skillId, String path, String resourc
*
* @param skillId The skill ID
* @param path The requested path that was not found
* @param resources The available resources map
* @param paths The available resources
* @return Formatted error message with available resources
*/
private String buildResourceNotFoundMessage(
String skillId, String path, Map<String, String> resources) {
private String buildResourceNotFoundMessage(String skillId, String path, Set<String> paths) {
StringBuilder message = new StringBuilder();
message.append("Resource not found: '")
.append(path)
Expand All @@ -241,8 +238,8 @@ private String buildResourceNotFoundMessage(
List<String> resourcePaths = new ArrayList<>();
resourcePaths.add("SKILL.md"); // Always add SKILL.md as the first resource

if (resources != null && !resources.isEmpty()) {
resourcePaths.addAll(resources.keySet());
if (paths != null && !paths.isEmpty()) {
resourcePaths.addAll(paths);
}

message.append("Available resources:\n");
Expand Down
Loading