Same form, three levels of AI integration. Each tab builds on the last by adding a single attribute.
The agent fills in the form fields, but the user must review and click
Search to submit. Only toolname and
tooldescription are required.
Adding toolautosubmit lets the agent fill and submit
the form automatically, no manual click required.
With a submit event listener you can intercept agent
submissions, run your own logic, and return a custom value to the
agent via event.respondWith().
| Attribute | Applies to | Description |
|---|---|---|
| Form attributes | ||
toolname |
<form> |
Registers the form as a WebMCP tool. Must be unique on the page. Use letters, digits, hyphens, underscores, and dots for compatibility with imperative tool names. |
tooltitle |
<form> |
Optional friendly display name shown in UIs. The agent uses toolname for invocation. |
tooldescription |
<form> |
Human-readable description of what the tool does. Helps the AI agent decide when and how to use this tool. |
toolautosubmit |
<form> |
When present, the form is submitted automatically after the agent fills it in. Without this, the user must submit manually. |
| Input attributes | ||
toolparamdescription |
<input>, <select>, <textarea> |
Describes the parameter so the agent knows what value to provide. For example: "Event date in YYYY-MM-DD format". |
| SubmitEvent properties | ||
event.agentInvoked |
SubmitEvent | Boolean. true when the form is submitted during an active tool invocation, including when the user submits after manual review. false for submissions outside a tool invocation. |
event.respondWith(promise) |
SubmitEvent | During the submit handler, first call preventDefault(), then pass a Promise that resolves to the tool's return value. Requires event.agentInvoked to be true. |