Skip to content

Add FormInput provider, bump prefab-ui to 0.15.0#3687

Merged
jlowin merged 1 commit intomainfrom
form-provider
Mar 29, 2026
Merged

Add FormInput provider, bump prefab-ui to 0.15.0#3687
jlowin merged 1 commit intomainfrom
form-provider

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Mar 29, 2026

FormInput generates a validated form from a Pydantic model. Define the model, add the provider, and the LLM can collect structured input from the user — no free-text parsing, no hallucinated responses.

from pydantic import BaseModel, Field
from fastmcp.apps.form import FormInput

class BugReport(BaseModel):
    title: str = Field(description="Brief summary")
    severity: Literal["low", "medium", "high", "critical"]
    description: str = Field(
        description="Detailed description",
        json_schema_extra={"ui": {"type": "textarea"}},
    )

mcp = FastMCP("My Server")
mcp.add_provider(FormInput(model=BugReport))

Field types, labels, placeholders, and validation are derived from the Pydantic model via Prefab's Form.from_model(). An optional on_submit callback processes the validated data server-side — without it, the validated JSON is returned directly.

Also bumps prefab-ui minimum to 0.15.0.

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@marvin-context-protocol marvin-context-protocol Bot added feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. server Related to FastMCP server implementation or server-side functionality. labels Mar 29, 2026
@jlowin jlowin merged commit 2c08ede into main Mar 29, 2026
9 checks passed
@jlowin jlowin deleted the form-provider branch March 29, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Major new functionality. Reserved for 2-4 significant PRs per release. Not for issues. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant