get-form-schema
Retrieve the schema for form fields when requesting human review in AI workflows, ensuring proper input structure for approval processes.
Instructions
Get the schema to use for the 'fields' property when requesting a human review with a form.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| formId | Yes | The form ID to fetch the schema for |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"formId": {
"description": "The form ID to fetch the schema for",
"type": "string"
}
},
"required": [
"formId"
],
"type": "object"
}
Implementation Reference
- src/index.ts:61-88 (handler)The asynchronous handler function that executes the logic for the 'get-form-schema' tool. It takes a formId, fetches the schema using GotoHuman.fetchSchemaForFormFields, and returns the schema or an error.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)The input schema definition for the 'get-form-schema' tool, using Zod to validate the required 'formId' parameter.{ formId: z.string().describe("The form ID to fetch the schema for") },
- src/index.ts:55-89 (registration)The registration of the 'get-form-schema' tool on the MCP server using server.tool(), 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 }; } } );