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. Letters, digits, hyphens, underscores, and dots only. |
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 submission was triggered by an AI agent, false when submitted by the user. |
event.respondWith(promise) |
SubmitEvent | Pass a Promise that resolves to the tool's return value. This lets you customize what the AI agent receives after form submission. |