Commit 1d3aad2fd for llama.cpp
commit 1d3aad2fd811a2a5efdd4eeb192eaefc1764519c
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Mon Nov 23 17:28:56 2026 +0100
server: ask exec_shell_command for a short description of the command (#32894)
The shell tool's schema gains a required `description` argument, listed
first: a short plain-language line on what the command does. The tool
ignores it, as before; clients can show it in place of the raw command
while the call streams and in their logs. Calls without it still run.
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/tools/server/server-tools.cpp b/tools/server/server-tools.cpp
index 060361968..7f4650157 100644
--- a/tools/server/server-tools.cpp
+++ b/tools/server/server-tools.cpp
@@ -1274,11 +1274,13 @@ struct server_tool_exec_shell_command : server_tool {
{"parameters", {
{"type", "object"},
{"properties", {
+ // first, so a client can show it while the command still streams; the tool ignores it
+ {"description", {{"type", "string"}, {"description", "Short plain-language description of what this command does, starting with a verb, e.g. 'List files in the project root'. 3 to 10 words. Shown to the user."}}},
{"command", {{"type", "string"}, {"description", "Shell command to execute"}}},
{"timeout", {{"type", "integer"}, {"description", string_format("Timeout in seconds (default 10, max %d)", SERVER_TOOL_EXEC_SHELL_COMMAND_MAX_TIMEOUT)}}},
{"max_output_size", {{"type", "integer"}, {"description", string_format("Maximum output size in bytes (default %zu)", SERVER_TOOL_EXEC_SHELL_COMMAND_MAX_OUTPUT_SIZE)}}},
}},
- {"required", json::array({"command"})},
+ {"required", json::array({"description", "command"})},
}},
}},
};
diff --git a/tools/server/tests/unit/test_tools_builtin.py b/tools/server/tests/unit/test_tools_builtin.py
index c830b0642..486ba8481 100755
--- a/tools/server/tests/unit/test_tools_builtin.py
+++ b/tools/server/tests/unit/test_tools_builtin.py
@@ -191,6 +191,23 @@ def test_tools_builtin_edit_file_rejects_non_unique_old_text(tmp_path):
os.remove(log_path)
+def test_tools_builtin_exec_shell_command_asks_for_a_description():
+ global server
+ server.start()
+
+ res = server.make_request("GET", "/tools")
+ assert res.status_code == 200, res.body
+ tool = next(t for t in res.body if t["tool"] == "exec_shell_command")
+ params = tool["definition"]["function"]["parameters"]
+ # first, so a client can show it while the command still streams
+ assert list(params["properties"])[0] == "description"
+ assert "description" in params["required"]
+
+ # the tool runs without it, as before
+ res = call_tool("exec_shell_command", {"command": "echo hi"})
+ assert "hi" in res["plain_text_response"]
+
+
def test_tools_builtin_exec_shell_command_stream():
global server
server.start()