mcp_form library

MCP Form - Form document creation, validation, rendering, and management for the MCP ecosystem.

This package provides business logic for form document operations using types defined in mcp_bundle (FormDocument, FormTemplate, etc.).

Classes

AnalysisBindingResolver
Resolves bindings from analysis service results.
AnalysisResultProvider
Provides analysis results for binding resolution.
AutoFixEngine
Engine that applies automatic corrections to fixable validation issues.
AutoFixResult
Result of an auto-fix operation.
BindingEngine
Orchestrates binding resolution across all data sources.
BindingResolver
Abstract resolver for a specific binding source type.
BindingResult
Result of binding resolution.
BoundField
A successfully resolved binding.
CanvasBindingResolver
Resolves canvas:// bindings by delegating to a CanvasSceneProvider.
CanvasRenderResult
Rendered bytes of a canvas scene for a given format.
CanvasSceneProvider
Provides live rendering of a canvas scene referenced by a canvas:// URI. Implementations live in the host (e.g. Designer's FormAdapter wires one that delegates to DesignerServer.internalRender).
ConflictDetector
Detects conflicts in concurrent patch operations using optimistic concurrency control (version-based).
DiffEntry
A single change between two document versions.
DocumentFactory
Factory for creating FormDocument instances from FormTemplates.
DocumentRenderer
Renderer interface for the registry.
DocumentSummary
Lightweight document projection for list/search queries.
DocxRenderer
DOCX output renderer using Flat OPC (Office Open XML) format.
FactGraphBindingResolver
Resolves bindings from FactGraph query results.
FactGraphQueryProvider
Provides FactGraph query results for binding resolution.
FormApprovalHandler
Simplified approval handler for form workflow transitions.
FormEventHandler
Simplified event handler for form workflow events.
FormFontPolicyDefaults
Predefined standard font policies.
FormMarginsFactory
Convenience factory methods for creating FormMargins.
FormPageSizeDefaults
Predefined standard page sizes as FormPageSize constants.
FormPortImpl
In-memory implementation of FormPort.
FormRendererPortImpl
Implementation of FormRendererPort that delegates to RendererRegistry.
FormResourceHandler
Exposes form-related data as MCP resources.
FormTemplatePortImpl
In-memory implementation of FormTemplatePort.
FormToolHandler
Handles MCP tool calls for the form.* namespace.
FormValidator
Facade that orchestrates schema validation, layout validation, and optional auto-fix for a FormDocument.
HtmlRenderer
HTML5 output renderer.
IncrementalBuilder
Incrementally builds a FormDocument section-by-section and block-by-block.
LayoutEnforcer
Pre-render layout validation.
LayoutValidator
Validates layout constraints for a FormDocument against its FormLayoutPolicy.
MarkdownRenderer
Markdown output renderer with GFM extensions.
McpResourceContent
Content returned by an MCP resource resolution.
McpResourceDefinition
Definition of an MCP resource for discovery.
McpToolDefinition
Definition of an MCP tool for discovery.
PatchConflict
Represents a detected patch conflict.
PatchEngine
RFC 6902 JSON Patch engine for FormDocument.
PatchError
Error from a patch operation.
PatchResult
Result of a patch operation.
PathConflict
Represents a path-level conflict between two operation sets.
PdfRenderer
PDF output renderer using raw PDF syntax.
RenderContext
Context passed to renderers during rendering.
RendererRegistry
Registry for document renderers.
RenderOptions
Options for rendering a document.
SchemaValidator
Validates a FormDocument's data against a FormSchema.
SignatureArtifact
Configuration for inserting a signature, stamp, or watermark.
SignatureInserter
Inserts signatures, stamps, and watermarks into approved documents.
TemplateSummary
Lightweight summary of a FormTemplate for list/search operations.
ToolBindingResolver
Resolves bindings from tool execution results.
ToolResultProvider
Provides tool execution results for binding resolution.
TransitionResult
Result of a state transition.
TransitionRule
Rule defining a valid state transition.
UiDslRenderer
AppPlayer UI DSL renderer adapter.
UnfilledField
A binding that could not be resolved.
UserInputBindingResolver
Resolves bindings from user-provided input data.
VersionDiffResult
Result of comparing two document versions.
VersionEntry
A snapshot of a document version.
VersionHistory
In-memory version history storage.
WorkflowEngine
Manages document state transitions with approval and version history support.

Enums

ArtifactPosition
Position where the artifact is inserted relative to the target.
ArtifactType
Type of artifact to insert into an approved document.
ConflictResolution
Suggested resolution strategy for a patch conflict.
DiffChangeType
Change type in a version diff.
FieldBindingStatus
Status of a single field binding.
FieldType
Supported data types for schema fields.

Extensions

DocumentCloning on FormDocument
Extension to clone a document as a new draft with fresh identity.
DocumentVersioning on FormDocument
Extension to create a new version of a document with incremented version.
FormDocumentStatusExtension on FormDocumentStatus
Extension providing convenience properties for FormDocumentStatus.
FormFontPolicyScale on FormFontPolicy
Extension providing heading size calculations for FormFontPolicy.
FormLayoutPolicyDimensions on FormLayoutPolicy
Extension providing computed layout dimensions for FormLayoutPolicy.
TemplateProjection on FormTemplate
Extension to create a TemplateSummary from a full FormTemplate.

Functions

allBlockPaths(FormDocument document) Map<String, String>
Generate paths for all blocks in a document.
blockPath(FormDocument document, String blockId) String?
Generate the JSON Pointer path for a block within a document.
checkModificationAllowed(FormDocument document) → FormError?
Check whether a modifying operation is permitted on this document.
isCompatibleWithRange(String? compatRange, String engineVersion) bool
Utility for checking engine version compatibility against a range string.
isValidTransition(FormDocumentStatus current, FormDocumentStatus target) bool
Validates whether a state transition is allowed.
isValidVersion(String version) bool
Validates that a version string follows semantic versioning (semver) format.
validateSchema(FormSchema schema, {List<FormSection>? sections}) List<FormError>
Validates the structural integrity of a FormSchema.
validTransitionsFrom(FormDocumentStatus current) Set<FormDocumentStatus>
Returns the set of valid target states from the given current state.

Exceptions / Errors

BindingMappingException
Thrown when a binding mapping fails.
BindingSourceUnavailableException
Thrown when a binding source is unavailable.
McpToolError
Error thrown by MCP tool/resource handlers.