| 55 | } |
| 56 | |
| 57 | QFuture<LLMQore::ToolResult> SkillTool::executeAsync(const QJsonObject &input) |
| 58 | { |
| 59 | const QString name = input["name"].toString().trimmed(); |
| 60 | |
| 61 | const std::optional<Skills::AgentSkill> found |
| 62 | = m_skillsManager ? m_skillsManager->findByName(name) : std::nullopt; |
| 63 | |
| 64 | return QtConcurrent::run([name, found]() -> LLMQore::ToolResult { |
| 65 | if (name.isEmpty()) { |
| 66 | throw LLMQore::ToolInvalidArgument( |
| 67 | "'name' parameter is required and cannot be empty"); |
| 68 | } |
| 69 | if (!found) { |
| 70 | throw LLMQore::ToolRuntimeError( |
| 71 | QString("Unknown skill: '%1'. Use a skill name from the Available Skills " |
| 72 | "catalog in the system prompt.") |
| 73 | .arg(name)); |
| 74 | } |
| 75 | if (found->body.isEmpty()) { |
| 76 | throw LLMQore::ToolRuntimeError( |
| 77 | QString("Skill '%1' has no instructions.").arg(found->name)); |
| 78 | } |
| 79 | |
| 80 | return LLMQore::ToolResult::text( |
| 81 | QString("Skill: %1\n\n%2").arg(found->name, found->body)); |
| 82 | }); |
| 83 | } |
| 84 | |
| 85 | } // namespace QodeAssist::Tools |
nothing calls this directly
no test coverage detected