feat(#1653): optional name param for bash run tool

This commit is contained in:
damocles 2026-06-13 16:08:31 +02:00 committed by mara
commit 9bd51a7440
5 changed files with 119 additions and 8 deletions

View file

@ -166,6 +166,15 @@ struct BashRunArgs {
/// `0` to disable inline waiting and always get the immediate response.
#[serde(default = "default_wait")]
wait_seconds: Option<u64>,
/// Optional task name. When set it becomes the task id, so it appears
/// in the completion wake (`from: "bash-task-<name>"`), in `status`
/// lookups, and in the loose-ends list — handy for recognising a task
/// later instead of an opaque hex id. A name can be reused once its
/// previous task has finished; reusing a name whose task is still
/// running is rejected. Allowed chars: ASCII letters, digits, `.`,
/// `_`, `-` (max 64). Omit to get the auto-generated id.
#[serde(default)]
name: Option<String>,
}
#[allow(
@ -204,13 +213,17 @@ impl BashMcp {
wake is fired; when the timeout expires the task keeps running and the normal \
`task started: id=<id>` response is returned. `wait_seconds` defaults to 3; \
pass `wait_seconds: 0` to disable inline waiting and always get the immediate \
response."
response. Pass `name` to label the task with a memorable id (used in the wake \
`from`, `status` lookups, and the loose-ends list) instead of an opaque hex id; \
a name is reusable once its prior task has finished, and rejected while one is \
still running."
)]
async fn run(&self, Parameters(args): Parameters<BashRunArgs>) -> String {
let req = DaemonRequest::BashRun {
cmd: args.cmd,
timeout_secs: args.timeout_secs,
wait_seconds: args.wait_seconds,
name: args.name,
};
let resp = round_trip(req).await;
// Extract the id from the response to format the result.