mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-28 08:06:16 +00:00
fix: address review nits on MCP get_run and delete-after-use waits
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
77164c296c
commit
6e63145a47
@@ -8409,8 +8409,8 @@ impl QueuedRun {
|
||||
result
|
||||
}
|
||||
|
||||
/// Whether its script deletes the run's data once its result is read, which only a
|
||||
/// caller waiting on that result does.
|
||||
/// Whether its script deletes the run's data after use, at once or after a delay: only a
|
||||
/// caller that waits for the result applies that setting.
|
||||
pub fn deletes_after_use(&self) -> bool {
|
||||
resolve_delete_after_secs(self.delete_after_use, self.delete_after_secs).is_some()
|
||||
}
|
||||
|
||||
@@ -112,8 +112,8 @@ impl WindmillBackend {
|
||||
queued: QueuedRun,
|
||||
request: &McpRequest<'_>,
|
||||
) -> BackendResult<Value> {
|
||||
// No later read can follow these: a hub script's run is outside what `get_run`
|
||||
// reads, and a run deleted once its result is read is gone by then.
|
||||
// A hub script's run is outside what `get_run` reads, and a script's delete-after-use
|
||||
// setting is applied only by a caller that waits for its result.
|
||||
if path.starts_with("hub/") || queued.deletes_after_use() {
|
||||
let response = queued
|
||||
.wait(&self.db, workspace_id, &auth.username)
|
||||
|
||||
@@ -884,12 +884,17 @@ impl<B: McpBackend> Runner<B> {
|
||||
));
|
||||
}
|
||||
|
||||
tools.extend(
|
||||
self.backend
|
||||
.session_tools(SessionAccess::ReadOnly)
|
||||
.into_iter()
|
||||
.find(|tool| tool.name == GET_RUN),
|
||||
);
|
||||
if scope_config.favorites
|
||||
|| scope_config.has_any("script")
|
||||
|| scope_config.has_any("flow")
|
||||
{
|
||||
tools.extend(
|
||||
self.backend
|
||||
.session_tools(SessionAccess::ReadOnly)
|
||||
.into_iter()
|
||||
.find(|tool| tool.name == GET_RUN),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Add endpoint tools from the generated MCP tools, filtered by scope.
|
||||
@@ -1142,7 +1147,10 @@ impl<B: McpBackend> Runner<B> {
|
||||
let id = args.get("id").and_then(Value::as_str).unwrap_or_default();
|
||||
let refused = || {
|
||||
ErrorData::invalid_params(
|
||||
format!("No run {id} of a script or flow this token runs"),
|
||||
format!(
|
||||
"No run {id} of a script or flow this token runs. For a step of a flow, \
|
||||
pass the flow's run id and the step's id as `step`."
|
||||
),
|
||||
None,
|
||||
)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user