Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion webmcp/declarative/toolchange-on-attribute-mutation.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,28 @@
assert_equals(tools[0].description, 'Restored Description');
}

// Test adding toolautosubmit attribute
{
const changePromise = waitForToolChange();
form.setAttribute('toolautosubmit', '');
await changePromise;

let tools = await navigator.modelContext.getTools();
assert_equals(tools.length, 1, "Tool still registered after adding toolautosubmit");
assert_equals(tools[0].name, 'new_tool_name', "Tool name is still the same");
}

// Test removing toolautosubmit attribute
{
const changePromise = waitForToolChange();
form.removeAttribute('toolautosubmit');
await changePromise;

let tools = await navigator.modelContext.getTools();
assert_equals(tools.length, 1, "Tool still registered after removing toolautosubmit");
assert_equals(tools[0].name, 'new_tool_name', "Tool name is still the same");
}

// Test removing toolname attribute (should unregister the tool since it's required)
{
const changePromise = waitForToolChange();
Expand All @@ -105,6 +127,6 @@
let tools = await navigator.modelContext.getTools();
assert_equals(tools.length, 0, "Tool should be unregistered when name is removed");
}
}, "Test that mutating or removing form attributes (toolname, tooldescription, tooltitle) fires toolchange and updates getTools() correctly");
}, "Test that mutating or removing form attributes (toolname, tooldescription, tooltitle, toolautosubmit) fires toolchange and updates getTools() correctly");
</script>
</body>
Loading