雖然代理程式通常可以推斷表單的運作方式,但提供宣告式 WebMCP 中繼資料可讓互動更可靠。
表單缺少宣告式 WebMCP 稽核的運作方式
Lighthouse 會找出沒有 toolname 和 tooldescription 的 <form> 元素。目前這項稽核僅供參考,不會產生任何警告。
如何修正
更新 HTML 表單,加入必要的 WebMCP 屬性:
<form toolname="newsletter_signup" tooldescription="Subscribes the user to the weekly newsletter">
<input name="email" type="email" toolparamdescription="The user's email address">
<button type="submit">Sign Up</button>
</form>