Skip to main content
Glama
backsoul

Dynamic Form MCP

by backsoul

create-form

Generate dynamic web forms with customizable fields like text inputs, dropdowns, and specialized elements for data collection and user interaction.

Instructions

Crea un formulario dinámico con campos personalizados

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYesTítulo del formulario
fieldsYesLista de campos del formulario

Implementation Reference

  • The handler function for the 'create-form' tool. It creates a new DynamicForm instance, adds a title field and the provided fields, generates the form URL asynchronously, logs the URL, and returns a text content block with either the success URL or an error message.
    const form = new DynamicForm(uuidv4()); form.addField({ type: 'text-title', name: title }); for (const field of fields) { form.addField(field); } const { url, error } = await form.createFormulary(); console.log('create-form - url: ', url); if (error != null) { return { content: [{ type: 'text', text: `Ha ocurrido un error: ${error}` }] }; } return { content: [{ type: 'text', text: `Formulario creado exitosamente: ${url}` }] }; }
  • Zod schema for the input parameters of the 'create-form' tool: 'title' (required string min length 3) and 'fields' (array of at least one field object with properties like type, name, label, etc.).
    { title: z.string().min(3).describe('Título del formulario'), fields: z .array( z.object({ type: z.string().describe('Tipo de campo (e.g., text-field, list-field)'), name: z.string().describe('Nombre del campo'), label: z.string().optional().describe('Etiqueta para mostrar en el formulario'), placeholder: z.string().optional().describe('Texto de marcador de posición'), required: z.boolean().optional().describe('Indica si el campo es obligatorio'), options: z.array(z.string()).optional().describe('Opciones para campos de lista'), url: z.string().optional().describe('URL para campos como qr-field o yt-video'), email: z.string().optional().describe('Correo electrónico para email-field'), subject: z.string().optional().describe('Asunto para email-field'), minLength: z.number().optional().describe('Longitud mínima para campos de texto'), maxLength: z.number().optional().describe('Longitud máxima para campos de texto'), pattern: z.string().optional().describe('Patrón de validación para campos de texto'), defaultValue: z.string().optional().describe('Valor por defecto del campo'), }) ) .min(1) .describe('Lista de campos del formulario'), }, async ({ title, fields }) => {
  • src/index.ts:17-60 (registration)
    The registration of the 'create-form' tool on the MCP server using server.tool(), including name, description, input schema, and handler function.
    server.tool( 'create-form', 'Crea un formulario dinámico con campos personalizados', { title: z.string().min(3).describe('Título del formulario'), fields: z .array( z.object({ type: z.string().describe('Tipo de campo (e.g., text-field, list-field)'), name: z.string().describe('Nombre del campo'), label: z.string().optional().describe('Etiqueta para mostrar en el formulario'), placeholder: z.string().optional().describe('Texto de marcador de posición'), required: z.boolean().optional().describe('Indica si el campo es obligatorio'), options: z.array(z.string()).optional().describe('Opciones para campos de lista'), url: z.string().optional().describe('URL para campos como qr-field o yt-video'), email: z.string().optional().describe('Correo electrónico para email-field'), subject: z.string().optional().describe('Asunto para email-field'), minLength: z.number().optional().describe('Longitud mínima para campos de texto'), maxLength: z.number().optional().describe('Longitud máxima para campos de texto'), pattern: z.string().optional().describe('Patrón de validación para campos de texto'), defaultValue: z.string().optional().describe('Valor por defecto del campo'), }) ) .min(1) .describe('Lista de campos del formulario'), }, async ({ title, fields }) => { const form = new DynamicForm(uuidv4()); form.addField({ type: 'text-title', name: title }); for (const field of fields) { form.addField(field); } const { url, error } = await form.createFormulary(); console.log('create-form - url: ', url); if (error != null) { return { content: [{ type: 'text', text: `Ha ocurrido un error: ${error}` }] }; } return { content: [{ type: 'text', text: `Formulario creado exitosamente: ${url}` }] }; } );
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/backsoul/dynamicform-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server