Skip to content

Commit 6999e1d

Browse files
committed
fix(ui): default condition path to '(any argument)'; relabel error (#966)
- Drop the '(pick an argument)' placeholder; default the path dropdown to '(any argument)' so the form is immediately submittable. - 'path is required' error reads 'argument is required' if it ever fires (it won't on the happy path now).
1 parent a8673e0 commit 6999e1d

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

src/ha_mcp/settings_ui.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,13 +2272,10 @@ def apply_tool_visibility(
22722272
const populatePathSelect = (selectedPath) => {
22732273
const paths = (toolSchema && toolSchema.paths) || [];
22742274
let html = '';
2275-
if (paths.length === 0) {
2276-
html += '<option value="">(no schema — type a path)</option>';
2277-
} else {
2278-
html += '<option value="">(pick an argument)</option>';
2279-
}
22802275
// Wildcard: match the predicate against EVERY argument of the call.
2281-
// Useful for catch-all rules like "block if any arg equals lock".
2276+
// Always first AND default, so the form has a sensible value out of
2277+
// the box and users never hit "argument is required" by saving an
2278+
// empty placeholder.
22822279
html += '<option value="args.*" ' +
22832280
'title="Match against every argument of the call. Combine with op=equals/is one of to gate on any arg having a given value.">' +
22842281
'(any argument)</option>';
@@ -2298,8 +2295,9 @@ def apply_tool_visibility(
22982295
// drop into custom mode automatically so we don't silently clobber
22992296
// the existing value.
23002297
if (selectedPath) {
2298+
const isWildcard = selectedPath === 'args.*';
23012299
const match = paths.find(p => p.path === selectedPath);
2302-
if (match) {
2300+
if (isWildcard || match) {
23032301
pathSelectEl.value = selectedPath;
23042302
pathCustomEl.style.display = 'none';
23052303
pathCustomEl.value = '';
@@ -2309,7 +2307,9 @@ def apply_tool_visibility(
23092307
pathCustomEl.value = selectedPath;
23102308
}
23112309
} else {
2312-
pathSelectEl.value = '';
2310+
// New condition: default to "(any argument)" so the form is
2311+
// immediately submittable once the user fills in a value.
2312+
pathSelectEl.value = 'args.*';
23132313
pathCustomEl.style.display = 'none';
23142314
pathCustomEl.value = '';
23152315
}
@@ -2580,7 +2580,7 @@ def apply_tool_visibility(
25802580
const op = opEl.value;
25812581
const path = currentPath();
25822582
if (!path) {
2583-
errorEl.textContent = 'path is required';
2583+
errorEl.textContent = 'argument is required';
25842584
errorEl.style.display = '';
25852585
return;
25862586
}

0 commit comments

Comments
 (0)