Align Skill Tool contract with PRD

- Register skill tool as 'skill' instead of 'skill_tool'
- Change parameter name from 'skill_name' to 'name'
- Update XML output to include name attribute: <skill_content name="...">
- Update test_tool_skill.sh and test_skill_filter.sh to reflect new names
This commit is contained in:
2026-05-20 18:16:25 -05:00
parent e62d63aa6f
commit f0160618da
4 changed files with 18 additions and 18 deletions
+2 -2
View File
@@ -158,6 +158,6 @@ inline void to_json(nlohmann::json& j, const HarnessState& s) {
}
struct SkillToolParams {
std::string skill_name;
std::string name;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SkillToolParams, skill_name)
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SkillToolParams, name)
+6 -6
View File
@@ -213,17 +213,17 @@ Tool make_skill_tool(const std::vector<SkillMetadata>& enabled_skills) {
}
return Tool{
.name = "skill_tool",
.name = "skill",
.description = desc_str,
.parameters_schema = {
{"type", "object"},
{"properties", {
{"skill_name", {
{"name", {
{"type", "string"},
{"description", "The name of the skill to retrieve."}
}}
}},
{"required", {"skill_name"}}
{"required", {"name"}}
},
.convert_params = [](const nlohmann::json& args) -> std::any {
return SkillToolParams(args.get<SkillToolParams>());
@@ -231,9 +231,9 @@ Tool make_skill_tool(const std::vector<SkillMetadata>& enabled_skills) {
.execute = [skill_map](const std::any& args) -> std::string {
auto params = std::any_cast<SkillToolParams>(args);
auto it = skill_map->find(params.skill_name);
auto it = skill_map->find(params.name);
if (it == skill_map->end()) {
return "Error: skill not found: " + params.skill_name;
return "Error: skill not found: " + params.name;
}
const SkillMetadata& skill = *it->second;
@@ -244,7 +244,7 @@ Tool make_skill_tool(const std::vector<SkillMetadata>& enabled_skills) {
files_list += f + "\n";
}
return "<skill_content>\n" + skill.raw_content + "\n</skill_content>\n<skill_files>\n" + files_list + "</skill_files>";
return "<skill_content name=\"" + params.name + "\">\n" + skill.raw_content + "\n</skill_content>\n<skill_files>\n" + files_list + "</skill_files>";
}
};
}
+4 -4
View File
@@ -28,10 +28,10 @@ Content for B
SKILL
# Mock response: ask for skill-b
tool_call skill_tool '{"skill_name":"skill-a"}' >> mock_responses_a.txt
tool_call skill '{"name":"skill-a"}' >> mock_responses_a.txt
be_done 'Done' >> mock_responses_a.txt
"${DRHARNESS}" -F chat_a.json -n -m "Use skill-a" -s skill-a -t skill_tool -d < "mock_responses_a.txt" >/dev/null 2>&1
"${DRHARNESS}" -F chat_a.json -n -m "Use skill-a" -s skill-a -t skill -d < "mock_responses_a.txt" >/dev/null 2>&1
# Check the result in chat history
RESULT=$(dr_result chat_a.json 2)
@@ -40,11 +40,11 @@ if ! echo "$RESULT" | grep -q "Content for A"; then
exit 1
fi
tool_call skill_tool '{"skill_name":"skill-b"}' >> mock_responses.txt
tool_call skill '{"name":"skill-b"}' >> mock_responses.txt
be_done 'Done' >> mock_responses.txt
# Run harness with only skill-a enabled via -s
"${DRHARNESS}" -F chat.json -n -m "Use skill-b" -s skill-a -t skill_tool -d < "mock_responses.txt" >/dev/null 2>&1
"${DRHARNESS}" -F chat.json -n -m "Use skill-b" -s skill-a -t skill -d < "mock_responses.txt" >/dev/null 2>&1
# Check the result in chat history
RESULT=$(dr_result chat.json 2)
+6 -6
View File
@@ -1,5 +1,5 @@
#!/bin/bash
# test_tool_skill.sh - Validates the skill_tool
# test_tool_skill.sh - Validates the skill tool
# Create test skill directories
mkdir -p skills
@@ -19,11 +19,11 @@ SKILL
# Create an extra file in the skill directory
echo "Some other content" > skills/other_file.txt
# Mock response: ask for skill_tool
tool_call skill_tool '{"skill_name":"test-skill"}' >> mock_responses.txt
# Mock response: ask for skill
tool_call skill '{"name":"test-skill"}' >> mock_responses.txt
be_done 'Done' >> mock_responses.txt
OUTPUT=$("${DRHARNESS}" -F chat.json -n -m "Use skill" -t skill_tool -d < "mock_responses.txt" 2>/dev/null)
OUTPUT=$("${DRHARNESS}" -F chat.json -n -m "Use skill" -t skill -d < "mock_responses.txt" 2>/dev/null)
if [ "${OUTPUT}" != "Done" ]; then
echo "FAIL: Expected 'Done', got '${OUTPUT}'"
@@ -33,8 +33,8 @@ fi
RESULT=$(dr_result chat.json 2)
# Check for XML structure
if ! echo "$RESULT" | grep -q "<skill_content>"; then
echo "FAIL: Missing <skill_content> in output"
if ! echo "$RESULT" | grep -q '<skill_content name="test-skill">'; then
echo "FAIL: Missing <skill_content name="test-skill"> in output"
exit 1
fi
if ! echo "$RESULT" | grep -q "</skill_content>"; then