/** * autoForm — Generates a Form from field definitions that submits to an MCP tool. * * Ported from mcp-generator-3.x display_tools.py → show_form. */ import { type ContainerComponent } from '../core/component.js'; import type { Action } from '../actions/types.js'; export interface AutoFormField { /** Field name (used as the key in submitted data). */ name: string; /** Display label. Defaults to humanized name. */ label?: string; /** Input type: 'text', 'email', 'number', 'password', 'url', etc. */ type?: string; /** Placeholder text. */ placeholder?: string; /** Whether the field is required. */ required?: boolean; } export interface AutoFormOptions { /** Form heading. */ title?: string; /** Optional subtitle. */ subtitle?: string; /** Submit button text. Default 'Submit'. */ submitLabel?: string; /** Custom onSubmit action. Overrides submitTool. */ onSubmit?: Action | Action[]; /** Success toast message. */ successMessage?: string; /** Error toast message. */ errorMessage?: string; } /** * Auto-generate a Form that submits to an MCP tool. * * @example * ```ts * autoForm( * [ * { name: 'email', label: 'Email', type: 'email', required: true }, * { name: 'name', label: 'Full Name', required: true }, * ], * 'create_user', * { title: 'Create User', submitLabel: 'Create' }, * ) * ``` */ export declare function autoForm(fields: AutoFormField[], submitTool: string, options?: AutoFormOptions): ContainerComponent; /** * Chainable form builder for rapid MCP tool UI generation. * * @example * ```ts * const ui = QuickForm('create_user') * .title('Create User') * .text('name', { required: true }) * .email('email', { required: true }) * .submit('Create') * .build() * ``` */ export declare class QuickFormBuilder { private _fields; private _title?; private _subtitle?; private _submitLabel; private _onSubmit?; private _successMessage?; private _errorMessage?; private _toolName; constructor(toolName: string); title(t: string): this; subtitle(s: string): this; submit(label: string): this; onSubmit(action: Action | Action[]): this; successMessage(msg: string): this; errorMessage(msg: string): this; /** Add a field with explicit type. */ field(name: string, opts?: Omit): this; /** Shorthand for type: 'text'. */ text(name: string, opts?: Omit): this; /** Shorthand for type: 'email'. */ email(name: string, opts?: Omit): this; /** Shorthand for type: 'number'. */ number(name: string, opts?: Omit): this; /** Shorthand for type: 'password'. */ password(name: string, opts?: Omit): this; /** Shorthand for type: 'url'. */ url(name: string, opts?: Omit): this; /** Shorthand for type: 'tel'. */ tel(name: string, opts?: Omit): this; /** Build the form component tree. */ build(): ContainerComponent; } /** Factory function for the chainable QuickForm builder. */ export declare function QuickForm(toolName: string): QuickFormBuilder; //# sourceMappingURL=form.d.ts.map