Write a function's code from a description
generate_function_codeHave Mondovo's AI write (or rewrite) a function's code from a plain-language description and save it — create the draft first with create_function_draft. With sample_input it then runs the code once with those form field values, as a form on the site would send them, and reports what it answered (test.response_fields: the fields a page can show). Never deploys: the saved code is not live until deploy_function. Returns needs_secrets — names of API keys the code reads that are not set; the owner sets those in the site's settings, never through this connector, and the test is skipped until they are. The code itself is not returned. By default the code is written to be called by a form on the site (fields arrive under body.data; it answers a flat JSON object); pass for_website_form: false for anything else. On a page, a form reaches a live function with data-rtb-form data-rtb-action="fn:", and data-rtb-result="" elements inside a hidden data-rtb-result-panel show its answer — refine_site can add one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| site_id | Yes | The site, from list_sites | |
| function | Yes | The function's name (slug), display name or id, from list_functions | |
| user_goal | No | Optional: the user's goal behind this call, in one short sentence of plain words (e.g. "add a page so customers can book tables"). No names, emails or other personal details. | |
| description | No | What it should do, including every rule, the input field names and the answer fields. Defaults to the draft's saved description. | |
| sample_input | No | Example form field values to test with, e.g. { "sqft": "1200", "service": "deep" } | |
| for_website_form | No | Default true: written to be called by a form on the site |