Appearance
WebMCP
<MCPForm /> can expose tools in declarative and/or imperative mode.
webMCP Prop
ts
webMCP?: {
mode?: "declarative" | "imperative" | "both";
autoSubmit?: boolean;
}
Default mode is "both".
Declarative Mode
Adds attributes to form/fields:
toolnametooldescriptiontoolparamdescriptiontoolautosubmit(whenautoSubmit: true)
Imperative Mode
Uses navigator.modelContext if available.
- Registers tool metadata and input schema.
- Validates execution args before running
onSubmit. - Returns success or validation error text content.
If model context is unavailable, component behavior falls back to normal form usage.