Skip to main content
Glama
backsoul

Dynamic Form MCP

by backsoul

create-answers

Add multiple responses to dynamic forms using UUIDs and field indices to populate form data efficiently.

Instructions

Agrega múltiples respuestas a uno o varios formularios mediante sus UUID y los índices de campo

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
answersYesArray de respuestas a crear

Implementation Reference

  • The handler function for the 'create-answers' tool. It creates a new DynamicForm instance and calls createAnswers with the provided answers array, handling errors and returning the responses as JSON.
    async ({ answers }) => {
      const form = new DynamicForm();
      const { responses, error } = await form.createAnswers(answers);
      if (error) {
        return { content: [{ type: "text", text: `Error al crear las respuestas: ${error}` }] };
      }
      return { content: [{ type: "text", text: JSON.stringify(responses, null, 2) }] };
    }
  • Zod input schema for the 'create-answers' tool, defining an array of answers each with uuid and fields array (index-value pairs).
    {
      answers: z
        .array(
          z.object({
            uuid: z.string().uuid().describe("UUID del formulario"),
            fields: z
              .array(
                z.object({
                  index: z.number().describe("Índice del campo"),
                  value: z.string().describe("Valor de la respuesta")
                })
              )
              .min(1)
              .describe("Lista de respuestas por campo")
          })
        )
        .min(1)
        .describe("Array de respuestas a crear"),
    },
  • src/index.ts:90-120 (registration)
    Registration of the 'create-answers' MCP tool using server.tool, including name, description, input schema, and handler function.
    server.tool(
      "create-answers",
      "Agrega múltiples respuestas a uno o varios formularios mediante sus UUID y los índices de campo",
      {
        answers: z
          .array(
            z.object({
              uuid: z.string().uuid().describe("UUID del formulario"),
              fields: z
                .array(
                  z.object({
                    index: z.number().describe("Índice del campo"),
                    value: z.string().describe("Valor de la respuesta")
                  })
                )
                .min(1)
                .describe("Lista de respuestas por campo")
            })
          )
          .min(1)
          .describe("Array de respuestas a crear"),
      },
      async ({ answers }) => {
        const form = new DynamicForm();
        const { responses, error } = await form.createAnswers(answers);
        if (error) {
          return { content: [{ type: "text", text: `Error al crear las respuestas: ${error}` }] };
        }
        return { content: [{ type: "text", text: JSON.stringify(responses, null, 2) }] };
      }
    );
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