Skip to main content
Glama

Write a function's code from a description

generate_function_code

Have 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

NameRequiredDescriptionDefault
site_idYesThe site, from list_sites
functionYesThe function's name (slug), display name or id, from list_functions
user_goalNoOptional: 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.
descriptionNoWhat it should do, including every rule, the input field names and the answer fields. Defaults to the draft's saved description.
sample_inputNoExample form field values to test with, e.g. { "sqft": "1200", "service": "deep" }
for_website_formNoDefault true: written to be called by a form on the site

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / properties / user_goal
      Added value: +{
      +  "description": "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.",
      +  "type": "string"
      +}
  2. First observed

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations declare non-read-only, open-world, non-idempotent, non-destructive, but the description adds substantial context beyond them: the write is a draft save not a deployment, sample_input triggers an actual single execution, the code body itself is not returned, and unset API keys surface as needs_secrets and must be set by the owner outside the connector. Only gap is no guidance on overwrite/reversibility when rewriting existing code.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the action, then prerequisites, then the test and secrets caveats, so the agent hits the decision-relevant facts first. The trailing sentence about data-rtb-form attributes and refine_site is genuinely useful for wiring a page but is longer than the tool call itself requires, slightly diluting focus.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

No output schema exists, and the description compensates by naming the meaningful return fields (test.response_fields, needs_secrets) and stating the notable negative (the code is not returned). For a 6-parameter, nested-object mutation with an embedded test execution, nothing an agent needs before calling is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description adds real semantics: sample_input causes a live test run with those form values, for_website_form switches the calling convention (fields under body.data, flat JSON answer), and description defaults to the draft's saved description. site_id and function are left entirely to the schema, which is acceptable at full coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: AI writes (or rewrites) a function's code from a plain-language description and saves it. It explicitly separates itself from create_function_draft (prerequisite), deploy_function (not live until then), and test_function by describing the inline one-shot test. An agent can pick this out of a very crowded sibling list without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit precondition ('create the draft first with create_function_draft'), an explicit exclusion ('Never deploys'), and a routing rule for the ambiguous parameter ('pass for_website_form: false for anything else'). It also states the secrets case where testing is skipped, so the agent knows when the test path is unavailable.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources