request-human-review-with-form
Submit structured data for human review using customizable forms to integrate approval workflows into AI agents and automations.
Instructions
Request a human review with a form. NOTE: If you don't have a form ID yet, list all available forms using the list-forms tool first. To know what to pass for fieldData, you need to fetch the schema for the form fields using the get-form-schema tool.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| formId | Yes | The form ID to request a human review for | |
| fieldData | Yes | The field data to include in the review request. Note that this is a dynamic schema that you need to fetch first using the get-form-schema tool. | |
| metadata | No | Optional additional data that will be incl. in the webhook response after form submission. Incl. everything required to proceed with your workflow. | |
| assignToUsers | No | Optional list of user emails to assign the review to |
Implementation Reference
- src/index.ts:104-150 (handler)The asynchronous handler function that implements the core logic of the tool: initializes GotoHuman, creates a review request, dynamically adds field data and optional metadata/users, sends the request, and returns the review ID and link or an error.async ({ formId, fieldData, metadata, assignToUsers }) => { try { const gotoHuman = new GotoHuman(); const reviewRequest = gotoHuman.createReview(formId); // Add all field data dynamically Object.entries(fieldData).forEach(([key, value]) => { reviewRequest.addFieldData(key, value); }); // Add optional metadata if provided if (metadata) { Object.entries(metadata).forEach(([key, value]) => { reviewRequest.addMetaData(key, value); }); } // Assign to specific users if provided if (assignToUsers) { reviewRequest.assignToUsers(assignToUsers); } const response = await reviewRequest.sendRequest(); return { content: [{ type: "text", text: JSON.stringify({ success: true, reviewId: response.reviewId, reviewLink: response.gthLink }) }] }; } 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:92-97 (schema)Zod schema defining the input parameters for the tool: formId (required string), fieldData (object), optional metadata and assignToUsers.const requestHumanReviewSchema = { formId: z.string().describe("The form ID to request a human review for"), fieldData: z.record(z.string(), z.any()).describe("The field data to include in the review request. Note that this is a dynamic schema that you need to fetch first using the get-form-schema tool."), metadata: z.record(z.string(), z.string()).optional().describe("Optional additional data that will be incl. in the webhook response after form submission. Incl. everything required to proceed with your workflow."), assignToUsers: z.array(z.string()).optional().describe("Optional list of user emails to assign the review to") };
- src/index.ts:100-151 (registration)The server.tool() call that registers the tool with its name, description, schema reference, and handler function.server.tool( "request-human-review-with-form", "Request a human review with a form. NOTE: If you don't have a form ID yet, list all available forms using the list-forms tool first. To know what to pass for fieldData, you need to fetch the schema for the form fields using the get-form-schema tool.", requestHumanReviewSchema, async ({ formId, fieldData, metadata, assignToUsers }) => { try { const gotoHuman = new GotoHuman(); const reviewRequest = gotoHuman.createReview(formId); // Add all field data dynamically Object.entries(fieldData).forEach(([key, value]) => { reviewRequest.addFieldData(key, value); }); // Add optional metadata if provided if (metadata) { Object.entries(metadata).forEach(([key, value]) => { reviewRequest.addMetaData(key, value); }); } // Assign to specific users if provided if (assignToUsers) { reviewRequest.assignToUsers(assignToUsers); } const response = await reviewRequest.sendRequest(); return { content: [{ type: "text", text: JSON.stringify({ success: true, reviewId: response.reviewId, reviewLink: response.gthLink }) }] }; } catch (error) { return { content: [{ type: "text", text: JSON.stringify({ success: false, error: error instanceof Error ? error.message : "Unknown error occurred" }) }], isError: true }; } } );