<wmcp-input>

A single-line text input. The reference implementation of WmcpFormControl.

<wmcp-input label="Email" name="email" type="email" helper-text="We'll never share it."></wmcp-input>

Element attributes

AttributeTypeDescription
typestringNative input type: text, email, url, tel, password, number, search.

Common attributes

These are shared by every <wmcp-*> form control:

AttributeTypeDescription
labelstringVisible label, associated with the control.
namestringForm field name; also the default tool name (fill_<name>).
valuestringCurrent value.
placeholderstringPlaceholder text.
requiredbooleanReal constraint — empty fails validation.
disabledbooleanDisables the control.
helper-textstringHelper text below the control.
required-messagestringCustom message when a required field is empty.
exposebooleanRegister a WebMCP tool for this control.
tool-namestringOverride the generated tool name.
tool-descriptionstringOverride the generated tool description.

schema (a Standard Schema validator) is set as a property, not an attribute:

import { z } from 'zod';
document.querySelector('wmcp-input')!.schema = z.string().email();