get-form-schema
Retrieve form schemas for human review requests in AI workflows, enabling structured data collection during approval processes.
Instructions
Get the schema to use for the 'fields' property when requesting a human review with a form.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| formId | Yes | The form ID to fetch the schema for |
Implementation Reference
- src/index.ts:61-88 (handler)The handler function for the 'get-form-schema' tool. It creates a GotoHuman instance, fetches the form fields schema using fetchSchemaForFormFields(formId), and returns it as JSON in the MCP response format. Handles errors by returning an error response.async ({ formId }) => { try { const gotoHuman = new GotoHuman(); const formFieldsSchema = await gotoHuman.fetchSchemaForFormFields(formId); return { content: [{ type: "text", text: JSON.stringify({ success: true, formId: formId, fieldsSchema: formFieldsSchema, }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error occurred" }) }], isError: true }; } }
- src/index.ts:58-60 (schema)Input schema for the 'get-form-schema' tool, defining the required 'formId' parameter as a string using Zod.{ formId: z.string().describe("The form ID to fetch the schema for") },
- src/index.ts:55-89 (registration)Registration of the 'get-form-schema' tool on the MCP server, including name, description, input schema, and handler function.server.tool( "get-form-schema", "Get the schema to use for the 'fields' property when requesting a human review with a form.", { formId: z.string().describe("The form ID to fetch the schema for") }, async ({ formId }) => { try { const gotoHuman = new GotoHuman(); const formFieldsSchema = await gotoHuman.fetchSchemaForFormFields(formId); return { content: [{ type: "text", text: JSON.stringify({ success: true, formId: formId, fieldsSchema: formFieldsSchema, }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error occurred" }) }], isError: true }; } } );